aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-08-31 17:56:50 +0200
committerJunio C Hamano <gitster@pobox.com>2010-08-31 11:07:34 -0700
commit1ee1e43df37e53b0bc50a0eda57dd1772dc220f5 (patch)
treed344ffe752def8ca44923bdd5b1096a82231548f /t
parentd8a94803842989582989fd5f5c3062c49134ad5b (diff)
downloadgit-1ee1e43df37e53b0bc50a0eda57dd1772dc220f5.tar.gz
git-1ee1e43df37e53b0bc50a0eda57dd1772dc220f5.tar.xz
notes: Don't create (empty) commit when removing non-existing notes
Extend remove_note() in the notes API to return whether or not a note was actually removed. Use this in 'git notes remove' to skip the creation of a notes commit when no notes were actually removed. Also add a test illustrating the change in behavior. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3301-notes.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 96b75813d..a2b79a043 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -365,6 +365,13 @@ c18dc024e14f08d18d14eea0d747ff692d66d6a3 1584215f1d29c65e99c6c6848626553fdd07fd7
c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 268048bfb8a1fb38e703baceb8ab235421bf80c5
EOF
+test_expect_success 'removing non-existing note should not create new commit' '
+ git rev-parse --verify refs/notes/commits > before_commit &&
+ test_must_fail git notes remove HEAD^ &&
+ git rev-parse --verify refs/notes/commits > after_commit &&
+ test_cmp before_commit after_commit
+'
+
test_expect_success 'list notes with "git notes list"' '
git notes list > output &&
test_cmp expect output