Add `git notes rm` and `git notes delete` as alternative ways of saying `git notes remove`. Signed-off-by: Adam Dinwoodie <adam@xxxxxxxxxxxxx> --- Documentation/git-notes.txt | 4 +++- builtin/notes.c | 8 +++++--- t/t3301-notes.sh | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Documentation/git-notes.txt b/Documentation/git-notes.txt index 43677297f..b1059dc85 100644 --- a/Documentation/git-notes.txt +++ b/Documentation/git-notes.txt @@ -17,7 +17,7 @@ SYNOPSIS 'git notes' merge [-v | -q] [-s <strategy> ] <notes-ref> 'git notes' merge --commit [-v | -q] 'git notes' merge --abort [-v | -q] -'git notes' remove [--ignore-missing] [--stdin] [<object>...] +'git notes' (remove|rm|delete) [--ignore-missing] [--stdin] [<object>...] 'git notes' prune [-n | -v] 'git notes' get-ref @@ -110,6 +110,8 @@ When done, the user can either finalize the merge with 'git notes merge --abort'. remove:: +rm:: +delete:: Remove the notes for given objects (defaults to HEAD). When giving zero or one object from the command line, this is equivalent to specifying an empty note message to diff --git a/builtin/notes.c b/builtin/notes.c index 12afdf190..cedb37535 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -32,7 +32,7 @@ static const char * const git_notes_usage[] = { N_("git notes [--ref <notes-ref>] merge [-v | -q] [-s <strategy>] <notes-ref>"), N_("git notes merge --commit [-v | -q]"), N_("git notes merge --abort [-v | -q]"), - N_("git notes [--ref <notes-ref>] remove [<object>...]"), + N_("git notes [--ref <notes-ref>] (remove|rm|delete) [<object>...]"), N_("git notes [--ref <notes-ref>] prune [-n | -v]"), N_("git notes [--ref <notes-ref>] get-ref"), NULL @@ -77,7 +77,7 @@ static const char * const git_notes_merge_usage[] = { }; static const char * const git_notes_remove_usage[] = { - N_("git notes remove [<object>]"), + N_("git notes (remove|rm|delete) [<object>]"), NULL }; @@ -1012,7 +1012,9 @@ int cmd_notes(int argc, const char **argv, const char *prefix) result = show(argc, argv, prefix); else if (!strcmp(argv[0], "merge")) result = merge(argc, argv, prefix); - else if (!strcmp(argv[0], "remove")) + else if (!strcmp(argv[0], "remove") || + !strcmp(argv[0], "rm") || + !strcmp(argv[0], "delete")) result = remove_cmd(argc, argv, prefix); else if (!strcmp(argv[0], "prune")) result = prune(argc, argv, prefix); diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index 2d200fdf3..50df9a3f9 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -353,9 +353,9 @@ test_expect_success 'create note with combination of -m and -F' ' test_cmp expect-combine_m_and_F actual ' -test_expect_success 'remove note with "git notes remove"' ' +test_expect_success 'remove note with "git notes remove/rm"' ' git notes remove HEAD^ && - git notes remove && + git notes rm && cat >expect-rm-remove <<-EOF && commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor <author@xxxxxxxxxxx> @@ -390,7 +390,7 @@ test_expect_success 'removing more than one' ' # 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 HEAD^^ HEAD^^^ && + git notes delete HEAD^^ HEAD^^^ && git notes list | sed -e "s/ .*//" >actual && test_cmp after-removal-expect actual ' -- 2.14.3