File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -126,17 +126,17 @@ defmodule Mix.SCM.Git do
126
126
update_origin ( opts [ :git ] )
127
127
128
128
# Fetch external data
129
- rev = get_lock_rev ( opts [ :lock ] , opts ) || get_opts_rev ( opts )
129
+ lock_rev = get_lock_rev ( opts [ :lock ] , opts )
130
130
131
131
[ "--git-dir=.git" , "fetch" , "--force" , "--quiet" ]
132
132
|> Kernel . ++ ( progress_switch ( git_version ( ) ) )
133
133
|> Kernel . ++ ( tags_switch ( opts [ :tag ] ) )
134
134
|> Kernel . ++ ( depth_switch ( opts [ :depth ] ) )
135
- |> Kernel . ++ ( refspec_switch ( opts , rev ) )
135
+ |> Kernel . ++ ( refspec_switch ( opts , lock_rev || get_opts_rev ( opts ) ) )
136
136
|> git! ( )
137
137
138
138
# Migrate the Git repo
139
- rev = rev || default_branch ( )
139
+ rev = lock_rev || get_origin_opts_rev ( opts ) || default_branch ( )
140
140
git! ( [ "--git-dir=.git" , "checkout" , "--quiet" , rev ] )
141
141
142
142
if opts [ :submodules ] do
@@ -314,6 +314,14 @@ defmodule Mix.SCM.Git do
314
314
opts [ :branch ] || opts [ :ref ] || opts [ :tag ]
315
315
end
316
316
317
+ defp get_origin_opts_rev ( opts ) do
318
+ if branch = opts [ :branch ] do
319
+ "origin/#{ branch } "
320
+ else
321
+ opts [ :ref ] || opts [ :tag ]
322
+ end
323
+ end
324
+
317
325
defp redact_uri ( git ) do
318
326
case URI . parse ( git ) do
319
327
% { userinfo: nil } -> git
You can’t perform that action at this time.
0 commit comments