Skip to content

Commit d976937

Browse files
committed
Flag lock as outdated if origins do not match
1 parent 349873a commit d976937

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ defmodule Mix.SCM.Git do
3131
File.cd!(opts[:dest], fn ->
3232
cond do
3333
lock_repo != opts[:git] -> :outdated
34+
lock_repo != get_origin -> :outdated
3435
lock_opts != get_lock_opts(opts) -> :outdated
3536
lock_rev != get_rev -> :mismatch
3637
true -> :ok
@@ -136,6 +137,12 @@ defmodule Mix.SCM.Git do
136137
nil
137138
end
138139

140+
defp get_origin do
141+
System.cmd('git config remote.origin.url')
142+
|> :string.strip(:right, ?\n)
143+
|> iolist_to_binary
144+
end
145+
139146
defp run_cmd_or_raise(command) do
140147
if Mix.shell.cmd(command) != 0 do
141148
raise Mix.Error, message: "Command `#{command}` failed"

0 commit comments

Comments
 (0)