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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Wijen <ben@xxxxxxxxx> writes:

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux