@@ -231,7 +231,7 @@ defmodule Mix.Tasks.DepsGitTest do
231231 Mix.Project . push ( GitApp )
232232
233233 # Get Git repo first revision
234- [ last , first | _ ] = get_git_repo_revs ( )
234+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
235235
236236 in_fixture "no_mixfile" , fn ->
237237 Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , first , [ ] } } )
@@ -257,7 +257,7 @@ defmodule Mix.Tasks.DepsGitTest do
257257
258258 test "updates the repo when the lock updates" do
259259 Mix.Project . push ( GitApp )
260- [ last , first | _ ] = get_git_repo_revs ( )
260+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
261261
262262 in_fixture "no_mixfile" , fn ->
263263 Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , first , [ ] } } )
@@ -349,7 +349,7 @@ defmodule Mix.Tasks.DepsGitTest do
349349
350350 test "updates the repo and the lock when the mixfile updates" do
351351 Mix.Project . push ( GitApp )
352- [ last , first | _ ] = get_git_repo_revs ( )
352+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
353353
354354 in_fixture "no_mixfile" , fn ->
355355 # Move to the first version
@@ -382,6 +382,32 @@ defmodule Mix.Tasks.DepsGitTest do
382382 purge ( [ GitRepo , GitRepo.MixProject ] )
383383 end
384384
385+ test "fetches children on updates" do
386+ Mix.Project . push ( DepsOnGitApp )
387+
388+ # Get Git repo first revision
389+ [ last , first | _ ] = get_git_repo_revs ( "deps_on_git_repo" )
390+
391+ in_fixture "no_mixfile" , fn ->
392+ Mix.Dep.Lock . write ( % { deps_on_git_repo: { :git , fixture_path ( "deps_on_git_repo" ) , first , [ ] } } )
393+
394+ Mix.Tasks.Deps.Get . run ( [ ] )
395+ assert File . exists? ( "deps/deps_on_git_repo/mix.exs" )
396+ refute File . exists? ( "deps/git_repo/lib/git_repo.ex" )
397+ assert File . read! ( "mix.lock" ) =~ first
398+
399+ Mix.Task . clear ( )
400+ Mix.ProjectStack . clear_cache ( )
401+ purge ( [ DepsOnGitRepo.MixProject ] )
402+
403+ Mix.Tasks.Deps.Update . run ( [ "deps_on_git_repo" ] )
404+ assert File . exists? ( "deps/git_repo/lib/git_repo.ex" )
405+ assert File . read! ( "mix.lock" ) =~ last
406+ end
407+ after
408+ purge ( [ GitRepo , GitRepo.MixProject ] )
409+ end
410+
385411 test "does not attempt to compile projects that could not be retrieved" do
386412 Mix.Project . push ( GitErrorApp )
387413
@@ -394,7 +420,7 @@ defmodule Mix.Tasks.DepsGitTest do
394420
395421 test "does not load bad mixfiles on get" do
396422 Mix.Project . push ( GitApp )
397- [ last , _ , bad | _ ] = get_git_repo_revs ( )
423+ [ last , _ , bad | _ ] = get_git_repo_revs ( "git_repo" )
398424
399425 in_fixture "no_mixfile" , fn ->
400426 Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , bad , [ ] } } )
@@ -428,7 +454,7 @@ defmodule Mix.Tasks.DepsGitTest do
428454
429455 test "does not load bad mixfiles on update" do
430456 Mix.Project . push ( GitApp )
431- [ last , _ , bad | _ ] = get_git_repo_revs ( )
457+ [ last , _ , bad | _ ] = get_git_repo_revs ( "git_repo" )
432458
433459 in_fixture "no_mixfile" , fn ->
434460 Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , bad , [ ] } } )
@@ -448,8 +474,8 @@ defmodule Mix.Tasks.DepsGitTest do
448474 Mix.Project . push ( name , file )
449475 end
450476
451- defp get_git_repo_revs ( ) do
452- File . cd! ( fixture_path ( "git_repo" ) , fn ->
477+ defp get_git_repo_revs ( repo ) do
478+ File . cd! ( fixture_path ( repo ) , fn ->
453479 Regex . split ( ~r( \r ?\n ) , System . cmd ( "git" , [ "log" , "--format=%H" ] ) |> elem ( 0 ) )
454480 end )
455481 end
0 commit comments