summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-09-22 08:30:44 -0500
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-09-22 08:30:44 -0500
commit86478aa2e65677eeea452bfd1fe12e0b4ec5f67c (patch)
tree5da03eb9bee0a516b8a4b40ce94ad6283981a88f
parentf7073eaf9bc49606f4f9f2599c1c95b0446ca1d8 (diff)
parent2fa68051ef773784c70ea94c365114a2472ff238 (diff)
Merge pull request #825 from fauxsoup/git-versioning-2
Git versioning 2
-rw-r--r--src/rebar_git_resource.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 5a24d1a..97e951e 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -194,10 +194,16 @@ 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 ->
- {undefined, "0.0.0"}
+ case rebar_utils:sh("git describe --tags --abbrev=0",
+ [{use_stdout, false}, return_on_error, {cd, Dir}]) of
+ {error, _} ->
+ {undefined, "0.0.0"};
+ {ok, LatestVsn} ->
+ {undefined, string:strip(LatestVsn, both, $\n)}
+ end
end
end.