From 3110d6e6758a31aa3b72842dc664ca160f07814b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 17 Apr 2021 13:26:08 +0200 Subject: [PATCH] t1404: annotate test cases with REFFILES * Reftable for now lacks detailed error messages for directory/file conflicts. Skip message comparisons. * Mark tests that muck with .git directly as REFFILES. Signed-off-by: Han-Wen Nienhuys --- t/t1404-update-ref-errors.sh | 56 +++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh index b729c1f4803040..811d5bb56d415c 100755 --- a/t/t1404-update-ref-errors.sh +++ b/t/t1404-update-ref-errors.sh @@ -27,7 +27,9 @@ test_update_rejected () { fi && printf "create $prefix/%s $C\n" $create >input && test_must_fail git update-ref --stdin output.err && - test_i18ngrep -F "$error" output.err && + if test_have_prereq REFFILES ; then + test_i18ngrep -F "$error" output.err + fi && git for-each-ref $prefix >actual && test_cmp unchanged actual } @@ -101,7 +103,9 @@ df_test() { printf "%s\n" "delete $delname" "create $addname $D" fi >commands && test_must_fail git update-ref --stdin output.err && - test_cmp expected-err output.err && + if test_have_prereq REFFILES ; then + test_cmp expected-err output.err + fi && printf "%s\n" "$C $delref" >expected-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && test_cmp expected-refs actual-refs @@ -336,7 +340,9 @@ test_expect_success 'missing old value blocks update' ' EOF printf "%s\n" "update $prefix/foo $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks update' ' @@ -347,7 +353,9 @@ test_expect_success 'incorrect old value blocks update' ' EOF printf "%s\n" "update $prefix/foo $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'existing old value blocks create' ' @@ -358,7 +366,9 @@ test_expect_success 'existing old value blocks create' ' EOF printf "%s\n" "create $prefix/foo $E" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks delete' ' @@ -369,7 +379,9 @@ test_expect_success 'incorrect old value blocks delete' ' EOF printf "%s\n" "delete $prefix/foo $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'missing old value blocks indirect update' ' @@ -380,7 +392,9 @@ test_expect_success 'missing old value blocks indirect update' ' EOF printf "%s\n" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks indirect update' ' @@ -392,7 +406,9 @@ test_expect_success 'incorrect old value blocks indirect update' ' EOF printf "%s\n" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'existing old value blocks indirect create' ' @@ -404,7 +420,9 @@ test_expect_success 'existing old value blocks indirect create' ' EOF printf "%s\n" "create $prefix/symref $E" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks indirect delete' ' @@ -416,7 +434,9 @@ test_expect_success 'incorrect old value blocks indirect delete' ' EOF printf "%s\n" "delete $prefix/symref $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'missing old value blocks indirect no-deref update' ' @@ -427,7 +447,9 @@ test_expect_success 'missing old value blocks indirect no-deref update' ' EOF printf "%s\n" "option no-deref" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks indirect no-deref update' ' @@ -439,7 +461,9 @@ test_expect_success 'incorrect old value blocks indirect no-deref update' ' EOF printf "%s\n" "option no-deref" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'existing old value blocks indirect no-deref create' ' @@ -451,7 +475,9 @@ test_expect_success 'existing old value blocks indirect no-deref create' ' EOF printf "%s\n" "option no-deref" "create $prefix/symref $E" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success 'incorrect old value blocks indirect no-deref delete' ' @@ -463,7 +489,9 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' ' EOF printf "%s\n" "option no-deref" "delete $prefix/symref $D" | test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err + if test_have_prereq REFFILES ; then + test_cmp expected output.err + fi ' test_expect_success REFFILES 'non-empty directory blocks create' '