From 46538012d943156ead4024fb510a1ce5d4ff443a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 18 May 2011 16:44:30 -0700 Subject: notes remove: --stdin reads from the standard input Teach the command to read object names to remove from the standard input, in addition to the object names given from the command line. Signed-off-by: Junio C Hamano --- t/t3301-notes.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 't') diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index e820a6bc7..16de05aff 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -475,6 +475,41 @@ test_expect_success 'removing with --ignore-missing but bogus ref' ' test "$before" = "$after" ' +test_expect_success 'remove reads from --stdin' ' + 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 rev-parse HEAD^^ HEAD^^^ >input && + git notes remove --stdin actual && + test_cmp after-removal-expect actual +' + +test_expect_success 'remove --stdin is also atomic' ' + before=$(git rev-parse --verify refs/notes/commits) && + test_when_finished "git update-ref refs/notes/commits $before" && + git rev-parse HEAD^^ HEAD^^^ HEAD^ >input && + test_must_fail git notes remove --stdin after-removal-expect && + git rev-parse HEAD^^ HEAD^^^ HEAD^ >input && + git notes remove --ignore-missing --stdin actual && + test_cmp after-removal-expect actual +' + test_expect_success 'list notes with "git notes list"' ' git notes list > output && test_cmp expect output -- cgit v1.2.1