From: Doan Tran Cong Danh <congdanhqx@gmail.com>
To: git@vger.kernel.org
Cc: Doan Tran Cong Danh <congdanhqx@gmail.com>
Subject: [PATCH 0/1] Allow default value for target of git-notes copy
Date: Tue, 15 Oct 2019 23:36:30 +0700 [thread overview]
Message-ID: <20191015163631.21808-1-congdanhqx@gmail.com> (raw)
As an alternate for the incoming patch,
this snippet could be used to eliminate some dead code in builtin/notes.c
Since `argc' will always be 2 in the removed condition.
Also:
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
---
builtin/notes.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index 02e97f55c5..641ae66f75 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -488,7 +488,6 @@ static int copy(int argc, const char **argv, const char *prefix)
{
int retval = 0, force = 0, from_stdin = 0;
const struct object_id *from_note, *note;
- const char *object_ref;
struct object_id object, from_obj;
struct notes_tree *t;
const char *rewrite_cmd = NULL;
@@ -525,10 +524,8 @@ static int copy(int argc, const char **argv, const char *prefix)
if (get_oid(argv[0], &from_obj))
die(_("failed to resolve '%s' as a valid ref."), argv[0]);
- object_ref = 1 < argc ? argv[1] : "HEAD";
-
- if (get_oid(object_ref, &object))
- die(_("failed to resolve '%s' as a valid ref."), object_ref);
+ if (get_oid(argv[1], &object))
+ die(_("failed to resolve '%s' as a valid ref."), argv[1]);
t = init_notes_check("copy", NOTES_INIT_WRITABLE);
note = get_note(t, &object);
--
2.23.0
next reply other threads:[~2019-10-15 16:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 16:36 Doan Tran Cong Danh [this message]
2019-10-15 16:36 ` [PATCH 1/1] notes: copy notes to HEAD by default Doan Tran Cong Danh
2019-10-16 2:01 ` Junio C Hamano
2019-10-16 5:17 ` Danh Doan
2019-10-16 5:18 ` [PATCH 1/2] t3301: test diagnose messages for too few/many paramters Doan Tran Cong Danh
2019-10-16 5:18 ` [PATCH 2/2] notes: fix minimum number of parameters to "copy" subcommand Doan Tran Cong Danh
2019-10-18 0:44 ` Junio C Hamano
2019-10-18 0:38 ` [PATCH 1/2] t3301: test diagnose messages for too few/many paramters Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191015163631.21808-1-congdanhqx@gmail.com \
--to=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).