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
126126 update_origin ( opts [ :git ] )
127127
128128 # Fetch external data
129- rev = get_lock_rev ( opts [ :lock ] , opts ) || get_opts_rev ( opts )
129+ lock_rev = get_lock_rev ( opts [ :lock ] , opts )
130130
131131 [ "--git-dir=.git" , "fetch" , "--force" , "--quiet" ]
132132 |> Kernel . ++ ( progress_switch ( git_version ( ) ) )
133133 |> Kernel . ++ ( tags_switch ( opts [ :tag ] ) )
134134 |> Kernel . ++ ( depth_switch ( opts [ :depth ] ) )
135- |> Kernel . ++ ( refspec_switch ( opts , rev ) )
135+ |> Kernel . ++ ( refspec_switch ( opts , lock_rev || get_opts_rev ( opts ) ) )
136136 |> git! ( )
137137
138138 # Migrate the Git repo
139- rev = rev || default_branch ( )
139+ rev = lock_rev || get_origin_opts_rev ( opts ) || default_branch ( )
140140 git! ( [ "--git-dir=.git" , "checkout" , "--quiet" , rev ] )
141141
142142 if opts [ :submodules ] do
@@ -314,6 +314,14 @@ defmodule Mix.SCM.Git do
314314 opts [ :branch ] || opts [ :ref ] || opts [ :tag ]
315315 end
316316
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+
317325 defp redact_uri ( git ) do
318326 case URI . parse ( git ) do
319327 % { userinfo: nil } -> git
You can’t perform that action at this time.
0 commit comments