From 54051bd5c338dfbf15660522dbd40cbad0451229 Mon Sep 17 00:00:00 2001 From: S L Date: Wed, 17 Dec 2014 23:27:58 +0100 Subject: [PATCH 1/2] https://github.com/ktoso/maven-git-commit-id-plugin/issues/149 : Using "-dirty" as default dirty-marker. --- README.md | 2 +- src/main/java/pl/project13/maven/git/GitDescribeConfig.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d0c215e..fcfc1095 100644 --- a/README.md +++ b/README.md @@ -575,7 +575,7 @@ Worth pointing out is, that git-commit-id tries to be 1-to-1 compatible with git * **abbrev** - `(default: 7)` in the describe output, the object id of the hash is always abbreviated to N letters, by default 7. The typical describe output you'll see therefore is: `v2.1.0-1-gf5cd254`, where `-1-` means the number of commits away from the mentioned tag and the `-gf5cd254` part means the first 7 chars of the current commit's id `f5cd254`. **Please note that the `g` prefix is included to notify you that it's a commit id, it is NOT part of the commit's object id** - *this is default git bevaviour, so we're doing the same*. You can set this to any value between 0 and 40 (inclusive). * **abbrev = 0** is a special case. Setting *abbrev* to `0` has the effect of hiding the "distance from tag" and "object id" parts of the output, so you endup with just the "nearest tag" (that is, instead `tag-12-gaaaaaaa` with `abbrev = 0` you'd get `tag`). -* **dirty** - `(default: "")` when you run describe on a repository that's in "dirty state" (has uncommited changes), the describe output will contain an additional suffix, such as "-devel" in this example: `v3.5-3-g2222222-devel`. You can configure that suffix to be anything you want, "-DEV" being a nice example. The "-" sign should be inclided in the configuration parameter, as it will not be added automatically. If in doubt run `git describe --dirty=-my_thing` to see how the end result will look like. +* **dirty** - `(default: "-dirty")` when you run describe on a repository that's in "dirty state" (has uncommited changes), the describe output will contain an additional suffix, such as "-devel" in this example: `v3.5-3-g2222222-devel`. You can configure that suffix to be anything you want, "-DEV" being a nice example. The "-" sign should be inclided in the configuration parameter, as it will not be added automatically. If in doubt run `git describe --dirty=-my_thing` to see how the end result will look like. * **tags** - `(default: false)` if true this option enables matching a lightweight (non-annotated) tag. * **match** - `(default: *)` only consider tags matching the given pattern (can be used to avoid leaking private tags made from the repository) * **long** - `(default: false)` git-describe, by default, returns just the tag name, if the current commit is tagged. Use this option to force it to format the output using the typical describe format. An example would be: `tagname-0-gc0ffebabe` - notice that the distance from the tag is 0 here, if you don't use **forceLongFormat** mode, the describe for such commit would look like this: `tagname`. diff --git a/src/main/java/pl/project13/maven/git/GitDescribeConfig.java b/src/main/java/pl/project13/maven/git/GitDescribeConfig.java index 3e9597d1..c12d3fb6 100644 --- a/src/main/java/pl/project13/maven/git/GitDescribeConfig.java +++ b/src/main/java/pl/project13/maven/git/GitDescribeConfig.java @@ -49,11 +49,11 @@ public class GitDescribeConfig { * Describe the working tree. It means describe HEAD and appends mark (
-dirty
by default) if the * working tree is dirty. * - * empty by default, following git's behaviour. + * -dirty by default, following git's behaviour. * - * @parameter default-value="" + * @parameter default-value="-dirty" */ - private String dirty = ""; + private String dirty = "-dirty"; /** *
--match glob-pattern
From 7efa3fc777d6f4299431c03952a89d710c730309 Mon Sep 17 00:00:00 2001 From: S L Date: Sat, 20 Dec 2014 00:37:13 +0100 Subject: [PATCH 2/2] As discussed in https://github.com/ktoso/maven-git-commit-id-plugin/pull/150 a fix for the travis tests --- .../project13/maven/git/GitCommitIdMojoIntegrationTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java b/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java index 3c2dbfd9..590bc42b 100644 --- a/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java +++ b/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java @@ -631,8 +631,8 @@ public void runGitDescribeWithMatchOption(boolean useNativeGit) throws Exception setProjectToExecuteMojoIn(targetProject); Map gitTagMap = new HashMap(); - gitTagMap.put("v2.1.8", "4f787aa37d5d9c06780278f0cf92553d304820a2"); - gitTagMap.put("v2.1.9", "a9dba4a25b64ab288d90cd503785b830d2e189a2"); + gitTagMap.put("v2.1.11", "4308260db9582682a686b473390a5261ccacd6ef"); + gitTagMap.put("v2.1.12", "42a0a939e6d5cd17389640170c969d519c14b302"); for (Map.Entry entry : gitTagMap.entrySet()) { String gitDescribeMatchNeedle = entry.getKey(); @@ -662,6 +662,7 @@ private GitDescribeConfig createGitDescribeConfig(boolean forceLongFormat, int a gitDescribeConfig.setTags(true); gitDescribeConfig.setForceLongFormat(forceLongFormat); gitDescribeConfig.setAbbrev(abbrev); + gitDescribeConfig.setDirty(""); return gitDescribeConfig; }