Re: [PATCH v6 1/2] builtin/rebase.c: make sure the active branch isn't moved when autostashing

Subsystems: the rest

2 messages, 2 authors, 2019-08-31 · open the first message on its own page

Re: [PATCH v6 1/2] builtin/rebase.c: make sure the active branch isn't moved when autostashing

From: Junio C Hamano <hidden>
Date: 2019-08-30 20:15:18

Ben Wijen [off-list ref] writes:
quoted hunk
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 670096c065..abcbfb8f01 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1968,9 +1968,13 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 				state_dir_path("autostash", &options);
 			struct child_process stash = CHILD_PROCESS_INIT;
 			struct object_id oid;
+			struct object_id head_oid;
+			if (get_oid("HEAD", &head_oid)) {
+				die(_("could not determine HEAD revision"));
+			}
Pointless {} pair around a single statement.
+
 			struct commit *head =
-				lookup_commit_reference(the_repository,
-							&options.orig_head);
+				lookup_commit_reference(the_repository, &head_oid);
This introduces decl-after-statement error, doesn't it?

Perhaps like so...
diff --git a/builtin/rebase.c b/builtin/rebase.c
index abcbfb8f01..0a2f9273ee 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1969,12 +1969,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			struct child_process stash = CHILD_PROCESS_INIT;
 			struct object_id oid;
 			struct object_id head_oid;
-			if (get_oid("HEAD", &head_oid)) {
-				die(_("could not determine HEAD revision"));
-			}
+			struct commit *head;
 
-			struct commit *head =
-				lookup_commit_reference(the_repository, &head_oid);
+			if (get_oid("HEAD", &head_oid))
+				die(_("could not determine HEAD revision"));
+			head = lookup_commit_reference(the_repository, &head_oid);
 
 			argv_array_pushl(&stash.args,
 					 "stash", "create", "autostash", NULL);

Re: [PATCH v6 1/2] builtin/rebase.c: make sure the active branch isn't moved when autostashing

From: Ben <hidden>
Date: 2019-08-31 07:17:20


On 30-08-2019 22:15, Junio C Hamano wrote:
Ben Wijen [off-list ref] writes:
quoted
+
 			struct commit *head =
-				lookup_commit_reference(the_repository,
-							&options.orig_head);
+				lookup_commit_reference(the_repository, &head_oid);
This introduces decl-after-statement error, doesn't it?

Perhaps like so...
Would you like me to send in another patch or leave it like this?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help