Skip to content

Allow default value for target of git-notes copy

Doan Tran Cong Danh git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1notes: copy notes to HEAD by defaultDocumentation/git-notes.txt builtin/notes.c t/t3301-notes.sh+8 -42 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] Allow default value for target of git-notes copy

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:

---

 builtin/notes.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
builtin/notes.c +2 -5
index 02e97f55c5..641ae66f75 100644
@@ -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);
Signature · 1 line
2.23.0