diff options
author | Johan Herland <johan@herland.net> | 2010-02-13 22:28:33 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-13 19:36:16 -0800 |
commit | 2347fae50b2f75c6c0b362bd9ef24249419ed2b1 (patch) | |
tree | 13975d09a3a5bbbe4b95d21ff8e0a54afe83bcdc /t/t3301-notes.sh | |
parent | 7aa4754e552eff22d70d496dea73a9c7639d66d3 (diff) | |
download | git-2347fae50b2f75c6c0b362bd9ef24249419ed2b1.tar.gz git-2347fae50b2f75c6c0b362bd9ef24249419ed2b1.tar.xz |
builtin-notes: Add "append" subcommand for appending to note objects
"git notes append" is equivalent to "git notes edit" except that instead
of editing existing notes contents, you can only append to it. This is
useful for quickly adding annotations like e.g.:
git notes append -m "Acked-by: A U Thor <author@example.com>"
"git notes append" takes the same -m/-F options as "git notes add".
If there is no existing note to append to, "git notes append" is identical
to "git notes add" (i.e. it adds a new note).
The patch includes tests verifying correct behaviour of the new subcommand.
Suggested-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-x | t/t3301-notes.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index df458ca93..290ed63d4 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -343,6 +343,42 @@ test_expect_success 'listing non-existing notes fails' ' test_cmp expect output ' +cat > expect << EOF +Initial set of notes + +More notes appended with git notes append +EOF + +test_expect_success 'append to existing note with "git notes append"' ' + git notes add -m "Initial set of notes" && + git notes append -m "More notes appended with git notes append" && + git notes show > output && + test_cmp expect output +' + +test_expect_success 'appending empty string does not change existing note' ' + git notes append -m "" && + git notes show > output && + test_cmp expect output +' + +test_expect_success 'git notes append == add when there is no existing note' ' + git notes remove HEAD && + test_must_fail git notes list HEAD && + git notes append -m "Initial set of notes + +More notes appended with git notes append" && + git notes show > output && + test_cmp expect output +' + +test_expect_success 'appending empty string to non-existing note does not create note' ' + git notes remove HEAD && + test_must_fail git notes list HEAD && + git notes append -m "" && + test_must_fail git notes list HEAD +' + test_expect_success 'create other note on a different notes ref (setup)' ' : > a6 && git add a6 && |