Skip to content

Commit dd3af04

Browse files
committed
Merge branch 'hn/refs-test-cleanup' into next
A handful of tests that assumed implementation details of files backend for refs have been cleaned up. * hn/refs-test-cleanup: t6001: avoid direct file system access t6500: use "ls -1" to snapshot ref database state t7064: use update-ref -d to remove upstream branch t1410: mark test as REFFILES t1405: mark test for 'git pack-refs' as REFFILES t1405: use 'git reflog exists' to check reflog existence
2 parents 689316a + 60a9160 commit dd3af04

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

t/t1405-main-ref-store.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
99

1010
RUN="test-tool ref-store main"
1111

12-
test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
13-
test_commit one &&
12+
13+
test_expect_success 'setup' '
14+
test_commit one
15+
'
16+
17+
test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
1418
N=`find .git/refs -type f | wc -l` &&
1519
test "$N" != 0 &&
1620
$RUN pack-refs 3 &&
@@ -98,12 +102,12 @@ test_expect_success 'reflog_exists(HEAD)' '
98102

99103
test_expect_success 'delete_reflog(HEAD)' '
100104
$RUN delete-reflog HEAD &&
101-
! test -f .git/logs/HEAD
105+
test_must_fail git reflog exists HEAD
102106
'
103107

104108
test_expect_success 'create-reflog(HEAD)' '
105109
$RUN create-reflog HEAD 1 &&
106-
test -f .git/logs/HEAD
110+
git reflog exists HEAD
107111
'
108112

109113
test_expect_success 'delete_ref(refs/heads/foo)' '

t/t1410-reflog.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '
374374
test_line_count = 3 actual
375375
'
376376

377-
test_expect_success 'reflog expire operates on symref not referrent' '
377+
# This test takes a lock on an individual ref; this is not supported in
378+
# reftable.
379+
test_expect_success REFFILES 'reflog expire operates on symref not referrent' '
378380
git branch --create-reflog the_symref &&
379381
git branch --create-reflog referrent &&
380382
git update-ref referrent HEAD &&

t/t6001-rev-list-graft.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ test_expect_success setup '
2323
git commit -a -m "Third in one history." &&
2424
A2=$(git rev-parse --verify HEAD) &&
2525
26-
rm -f .git/refs/heads/main .git/index &&
26+
git update-ref -d refs/heads/main &&
27+
rm -f .git/index &&
2728
2829
echo >fileA fileA again &&
2930
echo >subdir/fileB fileB again &&

t/t6500-gc.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ test_expect_success 'background auto gc respects lock for all operations' '
241241
242242
# create a ref whose loose presence we can use to detect a pack-refs run
243243
git update-ref refs/heads/should-be-loose HEAD &&
244-
test_path_is_file .git/refs/heads/should-be-loose &&
244+
(ls -1 .git/refs/heads .git/reftable >expect || true) &&
245245
246246
# now fake a concurrent gc that holds the lock; we can use our
247247
# shell pid so that it looks valid.
@@ -258,7 +258,8 @@ test_expect_success 'background auto gc respects lock for all operations' '
258258
259259
# our gc should exit zero without doing anything
260260
run_and_wait_for_auto_gc &&
261-
test_path_is_file .git/refs/heads/should-be-loose
261+
(ls -1 .git/refs/heads .git/reftable >actual || true) &&
262+
test_cmp expect actual
262263
'
263264

264265
# DO NOT leave a detached auto gc process running near the end of the

t/t7064-wtstatus-pv2.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,7 @@ test_expect_success 'verify upstream fields in branch header' '
373373
374374
## Test upstream-gone case. Fake this by pointing
375375
## origin/initial-branch at a non-existing commit.
376-
OLD=$(git rev-parse origin/initial-branch) &&
377-
NEW=$ZERO_OID &&
378-
mv .git/packed-refs .git/old-packed-refs &&
379-
sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
376+
git update-ref -d refs/remotes/origin/initial-branch &&
380377
381378
HUF=$(git rev-parse HEAD) &&
382379

0 commit comments

Comments
 (0)