diff options
author | Johan Herland <johan@herland.net> | 2010-02-14 00:28:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-14 06:36:15 +0300 |
commit | e397421abf1003c4da824441f91d8c990b70fa98 (patch) | |
tree | ad1290da7749f57de950f13d7684bbbbd6f2c8dc /t/t3301-notes.sh | |
parent | 7d541174650fb209a00b629d113cb954c24a19de (diff) |
builtin-notes: Add "list" subcommand for listing note objects
"git notes list" will list all note objects in the current notes ref (in the
format "<note object> <annotated object>"). "git notes list <object>" will
list the note object associated with the given <object>, or fail loudly if
the given <object> has no associated notes.
If no arguments are given to "git notes", it defaults to the "list"
subcommand. This is for pseudo-compatibility with "git tag" and "git branch".
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 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index d29daac5b4..768a1cb028 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -292,6 +292,38 @@ test_expect_success 'verify note removal with "git notes remove"' ' ! git notes show HEAD^ ' +cat > expect << EOF +c18dc024e14f08d18d14eea0d747ff692d66d6a3 1584215f1d29c65e99c6c6848626553fdd07fd75 +c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 268048bfb8a1fb38e703baceb8ab235421bf80c5 +EOF + +test_expect_success 'list notes with "git notes list"' ' + git notes list > output && + test_cmp expect output +' + +test_expect_success 'list notes with "git notes"' ' + git notes > output && + test_cmp expect output +' + +cat > expect << EOF +c18dc024e14f08d18d14eea0d747ff692d66d6a3 +EOF + +test_expect_success 'list specific note with "git notes list <object>"' ' + git notes list HEAD^^ > output && + test_cmp expect output +' + +cat > expect << EOF +EOF + +test_expect_success 'listing non-existing notes fails' ' + test_must_fail git notes list HEAD > output && + test_cmp expect output +' + test_expect_success 'create other note on a different notes ref (setup)' ' : > a6 && git add a6 && |