diff options
author | Stephen Boyd <bebarino@gmail.com> | 2010-02-27 00:59:22 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-12 22:09:18 -0800 |
commit | 74884b524e7e12b3419264d3180de785a9e39fa5 (patch) | |
tree | f6552409c466066c148caaadedf51f6be4f94b12 /t/t3301-notes.sh | |
parent | 66d681998411e8e5034080d5267a5e0f6cdc0c17 (diff) | |
download | git-74884b524e7e12b3419264d3180de785a9e39fa5.tar.gz git-74884b524e7e12b3419264d3180de785a9e39fa5.tar.xz |
notes: rework subcommands and parse options
Running 'git notes copy -h' is not very helfpul right now. It lists
the options for all the git notes subcommands and is rather confusing.
Fix this by splitting cmd_notes() into separate functions for each
subcommand (besides append and edit since they're very similar) and
only providing a usage message for the subcommand.
This has an added benefit of reducing the code complexity while making
it safer and easier to read. The downside is we get some code bloat
from similar setup and teardown needed for notes and options parsing.
We also get a bit stricter in options parsing by only allowing
the ref option to come before the subcommand.
Acked-by: Johan Herland <johan@herland.net>
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3301-notes.sh')
-rwxr-xr-x | t/t3301-notes.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index aeec90a8e..5b262114f 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -377,6 +377,17 @@ test_expect_success 'append to existing note with "git notes append"' ' test_cmp expect output ' +cat > expect_list << EOF +c18dc024e14f08d18d14eea0d747ff692d66d6a3 1584215f1d29c65e99c6c6848626553fdd07fd75 +c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 268048bfb8a1fb38e703baceb8ab235421bf80c5 +4b6ad22357cc8a1296720574b8d2fbc22fab0671 bd1753200303d0a0344be813e504253b3d98e74d +EOF + +test_expect_success '"git notes list" does not expand to "git notes list HEAD"' ' + git notes list > output && + test_cmp expect_list output +' + test_expect_success 'appending empty string does not change existing note' ' git notes append -m "" && git notes show > output && |