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);