Skip to content

Commit 67566f1

Browse files
committed
During update, always set the origin url to the lock url
1 parent d976937 commit 67566f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/mix/lib/mix/scm/git.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ defmodule Mix.SCM.Git do
5959

6060
def update(opts) do
6161
File.cd! opts[:dest], fn ->
62+
# Ensures origin is set the lock repo
63+
location = location(opts[:git])
64+
update_origin(location)
65+
6266
command = "git fetch --force --progress"
6367
if opts[:tag] do
6468
command = command <> " --tags"
@@ -143,6 +147,10 @@ defmodule Mix.SCM.Git do
143147
|> iolist_to_binary
144148
end
145149

150+
defp update_origin(location) do
151+
System.cmd('git config remote.origin.url #{location}')
152+
end
153+
146154
defp run_cmd_or_raise(command) do
147155
if Mix.shell.cmd(command) != 0 do
148156
raise Mix.Error, message: "Command `#{command}` failed"

0 commit comments

Comments
 (0)