Skip to content

Commit

Permalink
t5510: start tracking-ref tests from a known state
Browse files Browse the repository at this point in the history
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 12, 2013
1 parent b387c77 commit 51f8c81
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,20 @@ test_expect_success 'bundle should record HEAD correctly' '
'

test_expect_success 'mark initial state of origin/master' '
(
cd three &&
git tag base-origin-master refs/remotes/origin/master
)
'

test_expect_success 'explicit fetch should not update tracking' '
cd "$D" &&
git branch -f side &&
(
cd three &&
git update-ref refs/remotes/origin/master base-origin-master &&
o=$(git rev-parse --verify refs/remotes/origin/master) &&
git fetch origin master &&
n=$(git rev-parse --verify refs/remotes/origin/master) &&
Expand All @@ -390,6 +398,7 @@ test_expect_success 'explicit pull should not update tracking' '
git branch -f side &&
(
cd three &&
git update-ref refs/remotes/origin/master base-origin-master &&
o=$(git rev-parse --verify refs/remotes/origin/master) &&
git pull origin master &&
n=$(git rev-parse --verify refs/remotes/origin/master) &&
Expand All @@ -404,6 +413,7 @@ test_expect_success 'configured fetch updates tracking' '
git branch -f side &&
(
cd three &&
git update-ref refs/remotes/origin/master base-origin-master &&
o=$(git rev-parse --verify refs/remotes/origin/master) &&
git fetch origin &&
n=$(git rev-parse --verify refs/remotes/origin/master) &&
Expand Down

0 comments on commit 51f8c81

Please sign in to comment.