aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-18 16:02:58 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-19 10:46:42 -0700
commit2d370d2fbcf896912cc0739b806224f9a270bb5e (patch)
treea5454cafe8b7bcd8e4cd5dfed0b33b9bb6b751ed /t
parentc3ab1a8e4cb8a84967efcf45c5e6bee41b17f9f9 (diff)
downloadgit-2d370d2fbcf896912cc0739b806224f9a270bb5e.tar.gz
git-2d370d2fbcf896912cc0739b806224f9a270bb5e.tar.xz
notes remove: --ignore-missing
Depending on the application, it is not necessarily an error for an object to lack a note, especially if the only thing the caller wants to make sure is that notes are cleared for an object. By passing this option from the command line, the "git notes remove" command considers it a success if the object did not have any note to begin with. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3301-notes.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index f49879e03..e820a6bc7 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -455,6 +455,26 @@ test_expect_success 'removing is atomic' '
test "$before" = "$after"
'
+test_expect_success 'removing with --ignore-missing' '
+ before=$(git rev-parse --verify refs/notes/commits) &&
+ test_when_finished "git update-ref refs/notes/commits $before" &&
+
+ # We have only two -- add another and make sure it stays
+ git notes add -m "extra" &&
+ git notes list HEAD >after-removal-expect &&
+ git notes remove --ignore-missing HEAD^^ HEAD^^^ HEAD^ &&
+ git notes list | sed -e "s/ .*//" >actual &&
+ test_cmp after-removal-expect actual
+'
+
+test_expect_success 'removing with --ignore-missing but bogus ref' '
+ before=$(git rev-parse --verify refs/notes/commits) &&
+ test_when_finished "git update-ref refs/notes/commits $before" &&
+ test_must_fail git notes remove --ignore-missing HEAD^^ HEAD^^^ NO-SUCH-COMMIT &&
+ after=$(git rev-parse --verify refs/notes/commits) &&
+ test "$before" = "$after"
+'
+
test_expect_success 'list notes with "git notes list"' '
git notes list > output &&
test_cmp expect output