From a0b4dfa9b35a2ebac578ea5547b041bb78557238 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Sat, 13 Feb 2010 22:28:24 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- t/t3301-notes.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 't') diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index fd5e593ae6..fe59e73c21 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 +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 && -- cgit v1.2.1