@@ -231,7 +231,7 @@ defmodule Mix.Tasks.DepsGitTest do
231
231
Mix.Project . push ( GitApp )
232
232
233
233
# Get Git repo first revision
234
- [ last , first | _ ] = get_git_repo_revs ( )
234
+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
235
235
236
236
in_fixture "no_mixfile" , fn ->
237
237
Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , first , [ ] } } )
@@ -257,7 +257,7 @@ defmodule Mix.Tasks.DepsGitTest do
257
257
258
258
test "updates the repo when the lock updates" do
259
259
Mix.Project . push ( GitApp )
260
- [ last , first | _ ] = get_git_repo_revs ( )
260
+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
261
261
262
262
in_fixture "no_mixfile" , fn ->
263
263
Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , first , [ ] } } )
@@ -349,7 +349,7 @@ defmodule Mix.Tasks.DepsGitTest do
349
349
350
350
test "updates the repo and the lock when the mixfile updates" do
351
351
Mix.Project . push ( GitApp )
352
- [ last , first | _ ] = get_git_repo_revs ( )
352
+ [ last , first | _ ] = get_git_repo_revs ( "git_repo" )
353
353
354
354
in_fixture "no_mixfile" , fn ->
355
355
# Move to the first version
@@ -382,6 +382,32 @@ defmodule Mix.Tasks.DepsGitTest do
382
382
purge ( [ GitRepo , GitRepo.MixProject ] )
383
383
end
384
384
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
+
385
411
test "does not attempt to compile projects that could not be retrieved" do
386
412
Mix.Project . push ( GitErrorApp )
387
413
@@ -394,7 +420,7 @@ defmodule Mix.Tasks.DepsGitTest do
394
420
395
421
test "does not load bad mixfiles on get" do
396
422
Mix.Project . push ( GitApp )
397
- [ last , _ , bad | _ ] = get_git_repo_revs ( )
423
+ [ last , _ , bad | _ ] = get_git_repo_revs ( "git_repo" )
398
424
399
425
in_fixture "no_mixfile" , fn ->
400
426
Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , bad , [ ] } } )
@@ -428,7 +454,7 @@ defmodule Mix.Tasks.DepsGitTest do
428
454
429
455
test "does not load bad mixfiles on update" do
430
456
Mix.Project . push ( GitApp )
431
- [ last , _ , bad | _ ] = get_git_repo_revs ( )
457
+ [ last , _ , bad | _ ] = get_git_repo_revs ( "git_repo" )
432
458
433
459
in_fixture "no_mixfile" , fn ->
434
460
Mix.Dep.Lock . write ( % { git_repo: { :git , fixture_path ( "git_repo" ) , bad , [ ] } } )
@@ -448,8 +474,8 @@ defmodule Mix.Tasks.DepsGitTest do
448
474
Mix.Project . push ( name , file )
449
475
end
450
476
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 ->
453
479
Regex . split ( ~r( \r ?\n ) , System . cmd ( "git" , [ "log" , "--format=%H" ] ) |> elem ( 0 ) )
454
480
end )
455
481
end
0 commit comments