Skip to content

Commit 797e503

Browse files
committed
Move test case up
1 parent 58e76cc commit 797e503

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

lib/mix/test/mix/tasks/deps.git_test.exs

+15-19
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ defmodule Mix.Tasks.DepsGitTest do
7979
end)
8080
end
8181

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+
8297
@tag :git_sparse
8398
test "gets and updates Git repos with sparse checkout" do
8499
Process.put(:git_repo_opts, sparse: "sparse_dir")
@@ -478,22 +493,6 @@ defmodule Mix.Tasks.DepsGitTest do
478493
purge([GitRepo, GitRepo.MixProject])
479494
end
480495

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-
497496
describe "Git depth option" do
498497
@describetag :git_depth
499498

@@ -570,16 +569,13 @@ defmodule Mix.Tasks.DepsGitTest do
570569
#
571570
# https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt
572571
# https://stackoverflow.com/a/43136160
573-
574572
[<<short_sha1::binary-size(8), _::binary>>, _ | _] = get_git_repo_revs("git_repo")
575573

576574
Process.put(:git_repo_opts, depth: 1, ref: short_sha1)
577575

578576
in_fixture("no_mixfile", fn ->
579577
Mix.Project.push(GitApp)
580-
581578
exception = assert_raise Mix.Error, fn -> Mix.Tasks.Deps.Get.run([]) end
582-
583579
assert Exception.message(exception) =~ "a full commit hash is required"
584580
end)
585581
end

0 commit comments

Comments
 (0)