diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-09-17 19:16:57 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-09-17 19:16:57 -0500 |
commit | df203da7f386d911d5da51556872fa380b41fe33 (patch) | |
tree | df9a30e9ee484c58278195efdbe3ccc0f4ca7e0a | |
parent | 1d842d501839cae1a42ed5eef75d67290f2dc945 (diff) | |
parent | 1469e59c3afd437debf2f1649e03d814acf5eb1d (diff) |
Merge pull request #811 from fauxsoup/improved-git-versioning
Improved git versioning
-rw-r--r-- | src/rebar_git_resource.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 2fc1ba9..6405e46 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", + [{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. |