Teach builtin-notes to remove empty notes
[gitweb.git] / t / t3301-notes.sh
index fd5e593ae68c4ebec52904c03151dae872767d28..fe59e73c21289c545d6c25b7793c9085366e2adc 100755 (executable)
@@ -234,6 +234,37 @@ test_expect_success 'show -m notes' '
        test_cmp expect-m output
 '
 
+test_expect_success 'remove note with -F /dev/null (setup)' '
+       git notes edit -F /dev/null
+'
+
+cat > expect-rm-F << EOF
+commit bd1753200303d0a0344be813e504253b3d98e74d
+Author: A U Thor <author@example.com>
+Date:   Thu Apr 7 15:17:13 2005 -0700
+
+    5th
+EOF
+
+printf "\n" >> expect-rm-F
+cat expect-F >> expect-rm-F
+
+test_expect_success 'verify note removal with -F /dev/null' '
+       git log -4 > output &&
+       test_cmp expect-rm-F output &&
+       ! git notes show
+'
+
+test_expect_success 'do not create empty note with -m "" (setup)' '
+       git notes edit -m ""
+'
+
+test_expect_success 'verify non-creation of note with -m ""' '
+       git log -4 > output &&
+       test_cmp expect-rm-F output &&
+       ! git notes show
+'
+
 test_expect_success 'create other note on a different notes ref (setup)' '
        : > a6 &&
        git add a6 &&