Skip to content

Commit 51f8c81

Browse files
peffgitster
authored andcommitted
t5510: start tracking-ref tests from a known state
We have three sequential tests for for whether tracking refs are updated by various fetches and pulls; the first two should not update the ref, and the third should. Each test depends on the state left by the test before. This is fragile (a failing early test will confuse later tests), and means we cannot add more "should update" tests after the third one. Let's instead save the initial state before these tests, and then reset to a known state before running each test. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b387c77 commit 51f8c81

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

t/t5510-fetch.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,20 @@ test_expect_success 'bundle should record HEAD correctly' '
370370
371371
'
372372

373+
test_expect_success 'mark initial state of origin/master' '
374+
(
375+
cd three &&
376+
git tag base-origin-master refs/remotes/origin/master
377+
)
378+
'
379+
373380
test_expect_success 'explicit fetch should not update tracking' '
374381
375382
cd "$D" &&
376383
git branch -f side &&
377384
(
378385
cd three &&
386+
git update-ref refs/remotes/origin/master base-origin-master &&
379387
o=$(git rev-parse --verify refs/remotes/origin/master) &&
380388
git fetch origin master &&
381389
n=$(git rev-parse --verify refs/remotes/origin/master) &&
@@ -390,6 +398,7 @@ test_expect_success 'explicit pull should not update tracking' '
390398
git branch -f side &&
391399
(
392400
cd three &&
401+
git update-ref refs/remotes/origin/master base-origin-master &&
393402
o=$(git rev-parse --verify refs/remotes/origin/master) &&
394403
git pull origin master &&
395404
n=$(git rev-parse --verify refs/remotes/origin/master) &&
@@ -404,6 +413,7 @@ test_expect_success 'configured fetch updates tracking' '
404413
git branch -f side &&
405414
(
406415
cd three &&
416+
git update-ref refs/remotes/origin/master base-origin-master &&
407417
o=$(git rev-parse --verify refs/remotes/origin/master) &&
408418
git fetch origin &&
409419
n=$(git rev-parse --verify refs/remotes/origin/master) &&

0 commit comments

Comments
 (0)