@matheusbsbs / matheus-bagliano / commits / a15ad5d1bc
Fork 0

t1415: avoid using `main` as ref name

In preparation for a patch series that will change the fall-back for `init.defaultBranch` to `main`, let's not use `main` as ref name in this test script. Otherwise, the `git for-each-ref ... | grep main` which wants to catch those refs would also unexpectedly catch `refs/heads/main`. Since the refs in question are worktree-local ones (i.e. each worktree has their own, just like `HEAD`), and since the test case already uses a secondary worktree called "second", let's use the name "first" for those refs instead. While at it, adjust the test titles that talk about a "repo" when they meant a "worktree" instead. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Oct 8, 2020 at 10:13 UTC a15ad5d1bc23f3a6842360df5ee840b1dc3e4888
1 file changed +9 -9
t/t1415-worktree-refs.sh
+9 -9
@@ -76,24 +76,24 @@ test_expect_success 'reflog of worktrees/xx/HEAD' '
76 test_cmp expected actual.wt2
77 '
78
79 -test_expect_success 'for-each-ref from main repo' '
79 +test_expect_success 'for-each-ref from main worktree' '
80 mkdir fer1 &&
81 git -C fer1 init repo &&
82 test_commit -C fer1/repo initial &&
83 git -C fer1/repo worktree add ../second &&
84 - git -C fer1/repo update-ref refs/bisect/main HEAD &&
85 - git -C fer1/repo update-ref refs/rewritten/main HEAD &&
86 - git -C fer1/repo update-ref refs/worktree/main HEAD &&
87 - git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual &&
84 + git -C fer1/repo update-ref refs/bisect/first HEAD &&
85 + git -C fer1/repo update-ref refs/rewritten/first HEAD &&
86 + git -C fer1/repo update-ref refs/worktree/first HEAD &&
87 + git -C fer1/repo for-each-ref --format="%(refname)" | grep first >actual &&
88 cat >expected <<-\EOF &&
89 - refs/bisect/main
90 - refs/rewritten/main
91 - refs/worktree/main
89 + refs/bisect/first
90 + refs/rewritten/first
91 + refs/worktree/first
92 EOF
93 test_cmp expected actual
94 '
95
96 -test_expect_success 'for-each-ref from linked repo' '
96 +test_expect_success 'for-each-ref from linked worktree' '
97 mkdir fer2 &&
98 git -C fer2 init repo &&
99 test_commit -C fer2/repo initial &&