summaryrefslogtreecommitdiff
path: root/t/t3301-notes.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2014-11-09 12:30:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-11-10 20:08:21 (GMT)
commitd0923b6d4c01e3c5b86d56b1741292eda7c181fe (patch)
treec278d108cc26a49fbbc57ee77b555b43afb439c3 /t/t3301-notes.sh
parent511726e4b191ad76e7b4875d8f2361b05d5cfb39 (diff)
downloadgit-d0923b6d4c01e3c5b86d56b1741292eda7c181fe.zip
git-d0923b6d4c01e3c5b86d56b1741292eda7c181fe.tar.gz
git-d0923b6d4c01e3c5b86d56b1741292eda7c181fe.tar.bz2
t3301: verify that 'git notes' removes empty notes by default
Add test cases documenting the current behavior when trying to add/append/edit empty notes. This is in preparation for adding --allow-empty; to allow empty notes to be stored. Improved-by: Eric Sunshine <sunshine@sunshineco.com> Improved-by: Junio C Hamano <gitster@pobox.com> 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.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index cfd67ff..f74b3fa 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1239,4 +1239,31 @@ test_expect_success 'git notes get-ref (--ref)' '
test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz"
'
+test_expect_success 'setup testing of empty notes' '
+ test_unconfig core.notesRef &&
+ test_commit 16th &&
+ empty_blob=$(git hash-object -w /dev/null)
+'
+
+while read cmd
+do
+ test_expect_success "'git notes $cmd' removes empty note" "
+ test_might_fail git notes remove HEAD &&
+ MSG= git notes $cmd &&
+ test_must_fail git notes list HEAD
+ "
+done <<\EOF
+add
+add -F /dev/null
+add -m ""
+add -c "$empty_blob"
+add -C "$empty_blob"
+append
+append -F /dev/null
+append -m ""
+append -c "$empty_blob"
+append -C "$empty_blob"
+edit
+EOF
+
test_done