summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Hueras <zhueras@chitika.com>2015-09-21 11:36:03 -0400
committerZachary Hueras <zhueras@chitika.com>2015-09-21 11:36:03 -0400
commita70c1baf79d94f0e992673e886995a7bd48795a2 (patch)
tree71cde227f51f40f08cf8236d6e3e9283d9267f18
parentf7073eaf9bc49606f4f9f2599c1c95b0446ca1d8 (diff)
Only match current HEAD tag in git semver
In the scenario that someone had cloned an entire repository and then checked out an older version tag, the semantic versioning would detect the newest tag, not the checked out tag. Look for the HEAD string prior to tag: to indicate the currently selected tag.
-rw-r--r--src/rebar_git_resource.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 5a24d1a..0efdd1b 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -194,7 +194,7 @@ parse_tags(Dir) ->
{error, _} ->
{undefined, "0.0.0"};
{ok, Line} ->
- case re:run(Line, "(\\(|\\s)tag:\\s(v?([^,\\)]+))", [{capture, [2, 3], list}]) of
+ case re:run(Line, "(\\(|\\s)(HEAD,\\s)tag:\\s(v?([^,\\)]+))", [{capture, [3, 4], list}]) of
{match,[Tag, Vsn]} ->
{Tag, Vsn};
nomatch ->