builtin/notes: add --allow-empty, to allow storing empty notes
[gitweb.git] / t / t3301-notes.sh
index f74b3fa335235e61d91e7e2fb2947b637a9b425c..70ec5c395f861bf392ad91d7c9929337048500c8 100755 (executable)
@@ -1242,7 +1242,8 @@ test_expect_success 'git notes get-ref (--ref)' '
 test_expect_success 'setup testing of empty notes' '
        test_unconfig core.notesRef &&
        test_commit 16th &&
-       empty_blob=$(git hash-object -w /dev/null)
+       empty_blob=$(git hash-object -w /dev/null) &&
+       echo "$empty_blob" >expect_empty
 '
 
 while read cmd
@@ -1252,6 +1253,13 @@ do
                MSG= git notes $cmd &&
                test_must_fail git notes list HEAD
        "
+
+       test_expect_success "'git notes $cmd --allow-empty' stores empty note" "
+               test_might_fail git notes remove HEAD &&
+               MSG= git notes $cmd --allow-empty &&
+               git notes list HEAD >actual &&
+               test_cmp expect_empty actual
+       "
 done <<\EOF
 add
 add -F /dev/null