git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: git@vger.kernel.org
Cc: Johan Herland <johan@herland.net>
Subject: [PATCH] notes: add `rm` and `delete` commands
Date: Thu,  9 Nov 2017 13:46:17 +0000	[thread overview]
Message-ID: <20171109134617.65244-1-adam@dinwoodie.org> (raw)

Add `git notes rm` and `git notes delete` as alternative ways of saying
`git notes remove`.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
---
 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@example.com>
@@ -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


             reply	other threads:[~2017-11-09 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 13:46 Adam Dinwoodie [this message]
2017-11-09 16:18 ` [PATCH] notes: add `rm` and `delete` commands Eric Sunshine
2017-11-10  3:14   ` Junio C Hamano
2017-11-10 10:58     ` Adam Dinwoodie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171109134617.65244-1-adam@dinwoodie.org \
    --to=adam@dinwoodie.org \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).