Skip to content

Commit fa1033a

Browse files
john-caigitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1030d14 commit fa1033a

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

t/t0601-reffiles-pack-refs.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,34 @@ test_expect_success 'refs/worktree must not be packed' '
328328
test_path_is_file .git/worktrees/wt2/refs/worktree/foo
329329
'
330330

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+
331361
test_done

t/t5312-prune-corruption.sh

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
111111
test_cmp expect actual
112112
'
113113

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-
140114
test_done

0 commit comments

Comments
 (0)