summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Hueras <zhueras@chitika.com>2015-09-16 15:20:09 -0400
committerZachary Hueras <zhueras@chitika.com>2015-09-16 15:20:09 -0400
commit82faab2fe7683008a9a11a67abe49dd533916b47 (patch)
tree6ea63e2d6050eaf2a210a5b077e604d0d4156c2b
parent979610b44cba1feac72ce0954c66604b2f480808 (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 ->