t1406: move reffiles specific tests to t0600
Move this test to t0600 with the rest of the tests that are specific to reffiles. This test reaches into reflog directories manually, and so are specific to reffiles. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Cai committed
Jan 19, 2024 at 20:18 UTC
e74d9f57164fac7890946907ab56f5d84fff1b83
2 files changed
+48
-37
t/t0600-reffiles-backend.sh
+48
@@ -260,4 +260,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' '
260
test_cmp unchanged actual
261
'
262
263
+RWT="test-tool ref-store worktree:wt"
264
+RMAIN="test-tool ref-store worktree:main"
265
+
266
+test_expect_success 'setup worktree' '
267
+ test_commit first &&
268
+ git worktree add -b wt-main wt &&
269
+ (
270
+ cd wt &&
271
+ test_commit second
272
+ )
273
+'
274
+
275
+# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should
276
+# only appear in the for-each-reflog output if it is called from the correct
277
+# worktree, which is exercised in this test. This test is poorly written for
278
+# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses
279
+# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random
280
+# do not create reflogs by default, so it is not testing a realistic scenario.
281
+test_expect_success 'for_each_reflog()' '
282
+ echo $ZERO_OID > .git/logs/PSEUDO-MAIN &&
283
+ mkdir -p .git/logs/refs/bisect &&
284
+ echo $ZERO_OID > .git/logs/refs/bisect/random &&
285
+
286
+ echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&
287
+ mkdir -p .git/worktrees/wt/logs/refs/bisect &&
288
+ echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
289
+
290
+ $RWT for-each-reflog | cut -d" " -f 2- | sort >actual &&
291
+ cat >expected <<-\EOF &&
292
+ HEAD 0x1
293
+ PSEUDO-WT 0x0
294
+ refs/bisect/wt-random 0x0
295
+ refs/heads/main 0x0
296
+ refs/heads/wt-main 0x0
297
+ EOF
298
+ test_cmp expected actual &&
299
+
300
+ $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual &&
301
+ cat >expected <<-\EOF &&
302
+ HEAD 0x1
303
+ PSEUDO-MAIN 0x0
304
+ refs/bisect/random 0x0
305
+ refs/heads/main 0x0
306
+ refs/heads/wt-main 0x0
307
+ EOF
308
+ test_cmp expected actual
309
+'
310
+
311
test_done
t/t1407-worktree-ref-store.sh
-37
@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' '
53
test_cmp expected actual
54
'
55
56
-# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should
57
-# only appear in the for-each-reflog output if it is called from the correct
58
-# worktree, which is exercised in this test. This test is poorly written (and
59
-# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly
60
-# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3)
61
-# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is
62
-# not testing a realistic scenario.
63
-test_expect_success REFFILES 'for_each_reflog()' '
64
- echo $ZERO_OID > .git/logs/PSEUDO-MAIN &&
65
- mkdir -p .git/logs/refs/bisect &&
66
- echo $ZERO_OID > .git/logs/refs/bisect/random &&
67
-
68
- echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&
69
- mkdir -p .git/worktrees/wt/logs/refs/bisect &&
70
- echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
71
-
72
- $RWT for-each-reflog | cut -d" " -f 2- | sort >actual &&
73
- cat >expected <<-\EOF &&
74
- HEAD 0x1
75
- PSEUDO-WT 0x0
76
- refs/bisect/wt-random 0x0
77
- refs/heads/main 0x0
78
- refs/heads/wt-main 0x0
79
- EOF
80
- test_cmp expected actual &&
81
-
82
- $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual &&
83
- cat >expected <<-\EOF &&
84
- HEAD 0x1
85
- PSEUDO-MAIN 0x0
86
- refs/bisect/random 0x0
87
- refs/heads/main 0x0
88
- refs/heads/wt-main 0x0
89
- EOF
90
- test_cmp expected actual
91
-'
92
-
56
test_done