소스 검색

Merge pull request #2290 from tsloughter/revert-old-subdir

revert change to lock for regular git resource from PR #2239
pull/2293/head
Fred Hebert 5 년 전
committed by GitHub
부모
커밋
7c4b1a7e9b
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
2개의 변경된 파일11개의 추가작업 그리고 22개의 파일을 삭제
  1. +1
    -2
      rebar.lock
  2. +10
    -20
      src/rebar_git_resource.erl

+ 1
- 2
rebar.lock 파일 보기

@ -10,8 +10,7 @@
{<<"providers">>,{pkg,<<"providers">>,<<"1.8.1">>},0},
{<<"relx">>,
{git,"https://github.com/erlware/relx.git",
{ref,"aa6c81d265986f223fa347cacf3b9691e7b56f2f"},
[]},
{ref,"aa6c81d265986f223fa347cacf3b9691e7b56f2f"}},
0},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},0}]}.
[

+ 10
- 20
src/rebar_git_resource.erl 파일 보기

@ -34,11 +34,9 @@ lock(AppInfo, _) ->
check_type_support(),
lock_(rebar_app_info:dir(AppInfo), rebar_app_info:source(AppInfo)).
lock_(AppDir, {git, Url, _}) ->
lock_(AppDir, {git, Url});
lock_(AppDir, {git, Url}) ->
lock_(AppDir, {git, Url, [], []});
lock_(AppDir, {git, Url, Ref}) ->
lock_(AppDir, {git, Url, Ref, []});
lock_(AppDir, {git, Url, _, Opts}) ->
AbortMsg = lists:flatten(io_lib:format("Locking of git dependency failed in ~ts", [AppDir])),
Dir = rebar_utils:escape_double_quotes(AppDir),
{ok, VsnString} =
@ -52,13 +50,13 @@ lock_(AppDir, {git, Url, _, Opts}) ->
[{use_stdout, false}, {debug_abort_on_error, AbortMsg}])
end,
Ref = rebar_string:trim(VsnString, both, "\n"),
{git, Url, {ref, Ref}, Opts}.
{git, Url, {ref, Ref}}.
%% Return true if either the git url or tag/branch/ref is not the same as the currently
%% checked out git repo for the dep
needs_update(AppInfo, _) ->
check_type_support(),
needs_update_(rebar_app_info:dir(AppInfo), rm_source_opts(rebar_app_info:source(AppInfo))).
needs_update_(rebar_app_info:dir(AppInfo), rebar_app_info:source(AppInfo)).
needs_update_(Dir, {git, Url, {tag, Tag}}) ->
{ok, Current} = rebar_utils:sh(?FMT("git describe --tags --exact-match", []),
@ -138,37 +136,29 @@ download(TmpDir, AppInfo, State, _) ->
{error, Error}
end.
rm_source_opts({Type, Url, Ref}) ->
{Type, Url, Ref};
rm_source_opts({Type, Url, Ref, _Opts}) ->
{Type, Url, Ref}.
%% For backward compatibilty
download(Dir, AppInfo, State) ->
download_(Dir, AppInfo, State).
download_(Dir, {git, Url}, State) ->
?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []),
download_(Dir, {git, Url, {branch, "master"}, []}, State);
download_(Dir, {git, Url, {branch, "master"}}, State);
download_(Dir, {git, Url, ""}, State) ->
?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []),
download_(Dir, {git, Url, {branch, "master"}, []}, State);
download_(Dir, {git, Url, Checkout}, _State) ->
%% add an empty opts element to the tupel if there is none
download_(Dir, {git, Url, Checkout, []}, _State);
download_(Dir, {git, Url, {branch, Branch}, _Opts}, _State) ->
download_(Dir, {git, Url, {branch, "master"}}, State);
download_(Dir, {git, Url, {branch, Branch}}, _State) ->
ok = filelib:ensure_dir(Dir),
maybe_warn_local_url(Url),
git_clone(branch, git_vsn(), Url, Dir, Branch);
download_(Dir, {git, Url, {tag, Tag}, _Opts}, _State) ->
download_(Dir, {git, Url, {tag, Tag}}, _State) ->
ok = filelib:ensure_dir(Dir),
maybe_warn_local_url(Url),
git_clone(tag, git_vsn(), Url, Dir, Tag);
download_(Dir, {git, Url, {ref, Ref}, _Opts}, _State) ->
download_(Dir, {git, Url, {ref, Ref}}, _State) ->
ok = filelib:ensure_dir(Dir),
maybe_warn_local_url(Url),
git_clone(ref, git_vsn(), Url, Dir, Ref);
download_(Dir, {git, Url, Rev, _Opts}, _State) ->
download_(Dir, {git, Url, Rev}, _State) ->
?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []),
ok = filelib:ensure_dir(Dir),
maybe_warn_local_url(Url),

불러오는 중...
취소
저장