Skip to content

Commit

Permalink
t5312: move reffiles specific tests to t0600
Browse files Browse the repository at this point in the history
Move a few tests into t0600 since they specifically test the packed-refs
file and thus are specific to the reffiles backend.

Signed-off-by: John Cai <[email protected]>
  • Loading branch information
john-cai committed Jan 18, 2024
1 parent b5a986c commit 2b1e6ab
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
30 changes: 30 additions & 0 deletions t/t0600-reffiles-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' '
test_grep broken stderr
'

# we do not want to count on running pack-refs to
# actually pack it, as it is perfectly reasonable to
# skip processing a broken ref
test_expect_success 'create packed-refs file with broken ref' '
test_tick && git commit --allow-empty -m one &&
recoverable=$(git rev-parse HEAD) &&
test_tick && git commit --allow-empty -m two &&
missing=$(git rev-parse HEAD) &&
rm -f .git/refs/heads/main &&
cat >.git/packed-refs <<-EOF &&
$missing refs/heads/main
$recoverable refs/heads/other
EOF
echo $missing >expect &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_expect_success 'pack-refs does not silently delete broken packed ref' '
git pack-refs --all --prune &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_expect_success 'pack-refs does not drop broken refs during deletion' '
git update-ref -d refs/heads/other &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_done
26 changes: 0 additions & 26 deletions t/t5312-prune-corruption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
test_cmp expect actual
'

# we do not want to count on running pack-refs to
# actually pack it, as it is perfectly reasonable to
# skip processing a broken ref
test_expect_success REFFILES 'create packed-refs file with broken ref' '
rm -f .git/refs/heads/main &&
cat >.git/packed-refs <<-EOF &&
$missing refs/heads/main
$recoverable refs/heads/other
EOF
echo $missing >expect &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' '
git pack-refs --all --prune &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' '
git update-ref -d refs/heads/other &&
git rev-parse refs/heads/main >actual &&
test_cmp expect actual
'

test_done

0 comments on commit 2b1e6ab

Please sign in to comment.