aboutsummaryrefslogtreecommitdiff
path: root/t/t3301-notes.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-13 22:28:24 +0100
committerJunio C Hamano <gitster@pobox.com>2010-02-13 19:36:14 -0800
commita0b4dfa9b35a2ebac578ea5547b041bb78557238 (patch)
tree13c126a0b799f0251e9669dd25afa31b374e01aa /t/t3301-notes.sh
parent851c2b3791f24e319c23331887d4b8150ca4d9ba (diff)
downloadgit-a0b4dfa9b35a2ebac578ea5547b041bb78557238.tar.gz
git-a0b4dfa9b35a2ebac578ea5547b041bb78557238.tar.xz
Teach builtin-notes to remove empty notes
When the result of editing a note is an empty string, the associated note entry should be deleted from the notes tree. This allows deleting notes by invoking either "git notes -m ''" or "git notes -F /dev/null". Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3301-notes.sh')
-rwxr-xr-xt/t3301-notes.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index fd5e593ae..fe59e73c2 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -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 &&