summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2017-05-19 18:12:33 -0700
committerGitHub <noreply@github.com>2017-05-19 18:12:33 -0700
commit486cfa26949184c011d85ee4602750bba768794b (patch)
treed0c1ec9ebcd6ca4da116140bb3d13ca4b0f9ae8b /src
parent4649de6848529f0fe42f86e9a9d9216c2ed96993 (diff)
parent62a737766db4db04b05fa501df6dfd1401ce1f51 (diff)
Merge pull request #1513 from alinpopa/master
Fix git SHAs comparison for update.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_git_resource.erl16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 201b8b6..f666d17 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -53,24 +53,22 @@ needs_update(Dir, {git, Url, {branch, Branch}}) ->
needs_update(Dir, {git, Url, "master"}) ->
needs_update(Dir, {git, Url, {branch, "master"}});
needs_update(Dir, {git, _, Ref}) ->
- {ok, Current} = rebar_utils:sh(?FMT("git rev-parse -q HEAD", []),
+ {ok, Current} = rebar_utils:sh(?FMT("git rev-parse --short=7 -q HEAD", []),
[{cd, Dir}]),
Current1 = string:strip(string:strip(Current, both, $\n), both, $\r),
Ref2 = case Ref of
{ref, Ref1} ->
Length = length(Current1),
- if
- Length >= 7 ->
- lists:sublist(Ref1, Length);
- true ->
- Ref1
+ case Length >= 7 of
+ true -> lists:sublist(Ref1, Length);
+ false -> Ref1
end;
- Ref1 ->
- Ref1
+ _ ->
+ Ref
end,
- ?DEBUG("Comparing git ref ~s with ~s", [Ref1, Current1]),
+ ?DEBUG("Comparing git ref ~s with ~s", [Ref2, Current1]),
(Current1 =/= Ref2).
compare_url(Dir, Url) ->