@matheusbsbs / matheus-bagliano / commits / 0b7de6c683
Fork 0

t1400: use git rev-parse for testing PSEUDOREF existence

This will allow these tests to run with alternative ref backends Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Han-Wen Nienhuys committed Jul 16, 2020 at 18:45 UTC 0b7de6c6835051a92ae3e2ff306583f5780c7ae1
1 file changed +10 -10
t/t1400-update-ref.sh
+10 -10
@@ -475,57 +475,57 @@ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER
475
476 test_expect_success 'given old value for missing pseudoref, do not create' '
477 test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
478 - test_path_is_missing .git/PSEUDOREF &&
478 + test_must_fail git rev-parse PSEUDOREF &&
479 test_i18ngrep "could not read ref" err
480 '
481
482 test_expect_success 'create pseudoref' '
483 git update-ref PSEUDOREF $A &&
484 - test $A = $(cat .git/PSEUDOREF)
484 + test $A = $(git rev-parse PSEUDOREF)
485 '
486
487 test_expect_success 'overwrite pseudoref with no old value given' '
488 git update-ref PSEUDOREF $B &&
489 - test $B = $(cat .git/PSEUDOREF)
489 + test $B = $(git rev-parse PSEUDOREF)
490 '
491
492 test_expect_success 'overwrite pseudoref with correct old value' '
493 git update-ref PSEUDOREF $C $B &&
494 - test $C = $(cat .git/PSEUDOREF)
494 + test $C = $(git rev-parse PSEUDOREF)
495 '
496
497 test_expect_success 'do not overwrite pseudoref with wrong old value' '
498 test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
499 - test $C = $(cat .git/PSEUDOREF) &&
499 + test $C = $(git rev-parse PSEUDOREF) &&
500 test_i18ngrep "unexpected object ID" err
501 '
502
503 test_expect_success 'delete pseudoref' '
504 git update-ref -d PSEUDOREF &&
505 - test_path_is_missing .git/PSEUDOREF
505 + test_must_fail git rev-parse PSEUDOREF
506 '
507
508 test_expect_success 'do not delete pseudoref with wrong old value' '
509 git update-ref PSEUDOREF $A &&
510 test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
511 - test $A = $(cat .git/PSEUDOREF) &&
511 + test $A = $(git rev-parse PSEUDOREF) &&
512 test_i18ngrep "unexpected object ID" err
513 '
514
515 test_expect_success 'delete pseudoref with correct old value' '
516 git update-ref -d PSEUDOREF $A &&
517 - test_path_is_missing .git/PSEUDOREF
517 + test_must_fail git rev-parse PSEUDOREF
518 '
519
520 test_expect_success 'create pseudoref with old OID zero' '
521 git update-ref PSEUDOREF $A $Z &&
522 - test $A = $(cat .git/PSEUDOREF)
522 + test $A = $(git rev-parse PSEUDOREF)
523 '
524
525 test_expect_success 'do not overwrite pseudoref with old OID zero' '
526 test_when_finished git update-ref -d PSEUDOREF &&
527 test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
528 - test $A = $(cat .git/PSEUDOREF) &&
528 + test $A = $(git rev-parse PSEUDOREF) &&
529 test_i18ngrep "already exists" err
530 '
531