@@ -79,6 +79,21 @@ defmodule Mix.Tasks.DepsGitTest do
79
79
end )
80
80
end
81
81
82
+ test "gets with short ref" do
83
+ [ << short_sha1 :: binary - size ( 8 ) , _ :: binary >> , _ | _ ] = get_git_repo_revs ( "git_repo" )
84
+ Process . put ( :git_repo_opts , ref: short_sha1 )
85
+
86
+ in_fixture ( "no_mixfile" , fn ->
87
+ Mix.Project . push ( GitApp )
88
+
89
+ Mix.Tasks.Deps.Get . run ( [ ] )
90
+ message = "* Getting git_repo (#{ fixture_path ( "git_repo" ) } - #{ short_sha1 } )"
91
+ assert_received { :mix_shell , :info , [ ^ message ] }
92
+
93
+ refute_received { :mix_shell , :error , _ }
94
+ end )
95
+ end
96
+
82
97
@ tag :git_sparse
83
98
test "gets and updates Git repos with sparse checkout" do
84
99
Process . put ( :git_repo_opts , sparse: "sparse_dir" )
@@ -478,22 +493,6 @@ defmodule Mix.Tasks.DepsGitTest do
478
493
purge ( [ GitRepo , GitRepo.MixProject ] )
479
494
end
480
495
481
- test "fetches with short ref" do
482
- [ << short_sha1 :: binary - size ( 8 ) , _ :: binary >> , _ | _ ] = get_git_repo_revs ( "git_repo" )
483
-
484
- Process . put ( :git_repo_opts , ref: short_sha1 )
485
-
486
- in_fixture ( "no_mixfile" , fn ->
487
- Mix.Project . push ( GitApp )
488
-
489
- Mix.Tasks.Deps.Get . run ( [ ] )
490
- message = "* Getting git_repo (#{ fixture_path ( "git_repo" ) } - #{ short_sha1 } )"
491
- assert_received { :mix_shell , :info , [ ^ message ] }
492
-
493
- refute_received { :mix_shell , :error , _ }
494
- end )
495
- end
496
-
497
496
describe "Git depth option" do
498
497
@ describetag :git_depth
499
498
@@ -570,16 +569,13 @@ defmodule Mix.Tasks.DepsGitTest do
570
569
#
571
570
# https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt
572
571
# https://stackoverflow.com/a/43136160
573
-
574
572
[ << short_sha1 :: binary - size ( 8 ) , _ :: binary >> , _ | _ ] = get_git_repo_revs ( "git_repo" )
575
573
576
574
Process . put ( :git_repo_opts , depth: 1 , ref: short_sha1 )
577
575
578
576
in_fixture ( "no_mixfile" , fn ->
579
577
Mix.Project . push ( GitApp )
580
-
581
578
exception = assert_raise Mix.Error , fn -> Mix.Tasks.Deps.Get . run ( [ ] ) end
582
-
583
579
assert Exception . message ( exception ) =~ "a full commit hash is required"
584
580
end )
585
581
end
0 commit comments