ソースを参照

Fix git SHAs comparison for update.

86e883b8d8 always returns the full length SHA,
therefore when using a dependency having the short SHA,
it'll always consider that the SHAs are different,
hence it'll alway return true for .
pull/1513/head
Alin Popa 8年前
コミット
62a737766d
1個のファイルの変更7行の追加9行の削除
  1. +7
    -9
      src/rebar_git_resource.erl

+ 7
- 9
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, "master"}) ->
needs_update(Dir, {git, Url, {branch, "master"}}); needs_update(Dir, {git, Url, {branch, "master"}});
needs_update(Dir, {git, _, Ref}) -> 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}]), [{cd, Dir}]),
Current1 = string:strip(string:strip(Current, both, $\n), both, $\r), Current1 = string:strip(string:strip(Current, both, $\n), both, $\r),
Ref2 = case Ref of Ref2 = case Ref of
{ref, Ref1} -> {ref, Ref1} ->
Length = length(Current1), Length = length(Current1),
if
Length >= 7 ->
lists:sublist(Ref1, Length);
true ->
Ref1
case Length >= 7 of
true -> lists:sublist(Ref1, Length);
false -> Ref1
end; end;
Ref1 ->
Ref1
_ ->
Ref
end, end,
?DEBUG("Comparing git ref ~s with ~s", [Ref1, Current1]),
?DEBUG("Comparing git ref ~s with ~s", [Ref2, Current1]),
(Current1 =/= Ref2). (Current1 =/= Ref2).
compare_url(Dir, Url) -> compare_url(Dir, Url) ->

読み込み中…
キャンセル
保存