t5312: move reffiles specific tests to t0601
Move a few tests into t0601 since they specifically test the packed-refs file and thus are specific to the reffiles backend. 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:19 UTC
fa1033accc71edf978eb80043a6a35d7529e7209
2 files changed
+30
-26
t/t0601-reffiles-pack-refs.sh
+30
@@ -328,4 +328,34 @@ test_expect_success 'refs/worktree must not be packed' '
328
test_path_is_file .git/worktrees/wt2/refs/worktree/foo
329
'
330
331
+# we do not want to count on running pack-refs to
332
+# actually pack it, as it is perfectly reasonable to
333
+# skip processing a broken ref
334
+test_expect_success 'create packed-refs file with broken ref' '
335
+ test_tick && git commit --allow-empty -m one &&
336
+ recoverable=$(git rev-parse HEAD) &&
337
+ test_tick && git commit --allow-empty -m two &&
338
+ missing=$(git rev-parse HEAD) &&
339
+ rm -f .git/refs/heads/main &&
340
+ cat >.git/packed-refs <<-EOF &&
341
+ $missing refs/heads/main
342
+ $recoverable refs/heads/other
343
+ EOF
344
+ echo $missing >expect &&
345
+ git rev-parse refs/heads/main >actual &&
346
+ test_cmp expect actual
347
+'
348
+
349
+test_expect_success 'pack-refs does not silently delete broken packed ref' '
350
+ git pack-refs --all --prune &&
351
+ git rev-parse refs/heads/main >actual &&
352
+ test_cmp expect actual
353
+'
354
+
355
+test_expect_success 'pack-refs does not drop broken refs during deletion' '
356
+ git update-ref -d refs/heads/other &&
357
+ git rev-parse refs/heads/main >actual &&
358
+ test_cmp expect actual
359
+'
360
+
361
test_done
t/t5312-prune-corruption.sh
-26
@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
111
test_cmp expect actual
112
'
113
114
-# we do not want to count on running pack-refs to
115
-# actually pack it, as it is perfectly reasonable to
116
-# skip processing a broken ref
117
-test_expect_success REFFILES 'create packed-refs file with broken ref' '
118
- rm -f .git/refs/heads/main &&
119
- cat >.git/packed-refs <<-EOF &&
120
- $missing refs/heads/main
121
- $recoverable refs/heads/other
122
- EOF
123
- echo $missing >expect &&
124
- git rev-parse refs/heads/main >actual &&
125
- test_cmp expect actual
126
-'
127
-
128
-test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' '
129
- git pack-refs --all --prune &&
130
- git rev-parse refs/heads/main >actual &&
131
- test_cmp expect actual
132
-'
133
-
134
-test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' '
135
- git update-ref -d refs/heads/other &&
136
- git rev-parse refs/heads/main >actual &&
137
- test_cmp expect actual
138
-'
139
-
114
test_done