From 581a01c405842b7508878a6ce36aa8a25bd0e88d Mon Sep 17 00:00:00 2001
From: Yakov <xazar.studio@gmail.com>
Date: Fri, 25 Mar 2016 12:03:09 +0400
Subject: Fixed git version bug
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I've tried to compile project with git in .app.src vsn
Project was tagged as 1.0.0, but resulting .app vsn becomes 1.0.0+build.6.reff0aec24

```git lg
* f0aec24 - (80 минут назад) Fixed ct — Kozlov Yakov (HEAD -> master, tag: 1.0.0, origin/master)
... 5 commits before
```

```
$ git log --oneline --no-walk --tags --decorate
f0aec24 (HEAD -> master, tag: 1.0.0, origin/master) Fixed ct
```

I've found that `HEAD -> master` doest match pattern in [rebar_git_resource](https://github.com/erlang/rebar3/blob/master/src/rebar_git_resource.erl#L204)
---
 src/rebar_git_resource.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 876d047..5a6a5ef 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -201,7 +201,7 @@ parse_tags(Dir) ->
         {error, _} ->
             {undefined, "0.0.0"};
         {ok, Line} ->
-            case re:run(Line, "(\\(|\\s)(HEAD,\\s)tag:\\s(v?([^,\\)]+))", [{capture, [3, 4], list}]) of
+            case re:run(Line, "(\\(|\\s)(HEAD[^,]*,\\s)tag:\\s(v?([^,\\)]+))", [{capture, [3, 4], list}]) of
                 {match,[Tag, Vsn]} ->
                     {Tag, Vsn};
                 nomatch ->
-- 
cgit v1.1