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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 11, 2013 at 18:14 UTC 51f8c814d5603a917a91a47019875bbe707675bb
1 file changed +10
t/t5510-fetch.sh
+10
@@ -370,12 +370,20 @@ test_expect_success 'bundle should record HEAD correctly' '
370
371 '
372
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 +
380 test_expect_success 'explicit fetch should not update tracking' '
381
382 cd "$D" &&
383 git branch -f side &&
384 (
385 cd three &&
386 + git update-ref refs/remotes/origin/master base-origin-master &&
387 o=$(git rev-parse --verify refs/remotes/origin/master) &&
388 git fetch origin master &&
389 n=$(git rev-parse --verify refs/remotes/origin/master) &&
@@ -390,6 +398,7 @@ test_expect_success 'explicit pull should not update tracking' '
398 git branch -f side &&
399 (
400 cd three &&
401 + git update-ref refs/remotes/origin/master base-origin-master &&
402 o=$(git rev-parse --verify refs/remotes/origin/master) &&
403 git pull origin master &&
404 n=$(git rev-parse --verify refs/remotes/origin/master) &&
@@ -404,6 +413,7 @@ test_expect_success 'configured fetch updates tracking' '
413 git branch -f side &&
414 (
415 cd three &&
416 + git update-ref refs/remotes/origin/master base-origin-master &&
417 o=$(git rev-parse --verify refs/remotes/origin/master) &&
418 git fetch origin &&
419 n=$(git rev-parse --verify refs/remotes/origin/master) &&