git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'
@ 2020-01-21 19:32 Alban Gruin
  2020-01-22 14:00 ` Johannes Schindelin
  2020-01-22 20:47 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Alban Gruin @ 2020-01-21 19:32 UTC (permalink / raw)
  To: git, phillip.wood, Johannes Schindelin, Junio C Hamano; +Cc: Alban Gruin

When `options.switch_to' is set, `options.orig_head' is populated right
after.  Therefore, there is no need to parse `switch_to' again.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
 builtin/rebase.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 6154ad8fa5..16d2ec7ebc 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -2056,19 +2056,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		if (!(options.flags & REBASE_FORCE)) {
 			/* Lazily switch to the target branch if needed... */
 			if (options.switch_to) {
-				struct object_id oid;
-
-				if (get_oid(options.switch_to, &oid) < 0) {
-					ret = !!error(_("could not parse '%s'"),
-						      options.switch_to);
-					goto cleanup;
-				}
-
 				strbuf_reset(&buf);
 				strbuf_addf(&buf, "%s: checkout %s",
 					    getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
 					    options.switch_to);
-				if (reset_head(&oid, "checkout",
+				if (reset_head(&options.orig_head, "checkout",
 					       options.head_name,
 					       RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
 					       NULL, buf.buf) < 0) {
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'
  2020-01-21 19:32 [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to' Alban Gruin
@ 2020-01-22 14:00 ` Johannes Schindelin
  2020-01-22 20:47 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2020-01-22 14:00 UTC (permalink / raw)
  To: Alban Gruin; +Cc: git, phillip.wood, Junio C Hamano

Hi Alban,

On Tue, 21 Jan 2020, Alban Gruin wrote:

> When `options.switch_to' is set, `options.orig_head' is populated right
> after.  Therefore, there is no need to parse `switch_to' again.
>
> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

ACK!
Dscho

> ---
>  builtin/rebase.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 6154ad8fa5..16d2ec7ebc 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -2056,19 +2056,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		if (!(options.flags & REBASE_FORCE)) {
>  			/* Lazily switch to the target branch if needed... */
>  			if (options.switch_to) {
> -				struct object_id oid;
> -
> -				if (get_oid(options.switch_to, &oid) < 0) {
> -					ret = !!error(_("could not parse '%s'"),
> -						      options.switch_to);
> -					goto cleanup;
> -				}
> -
>  				strbuf_reset(&buf);
>  				strbuf_addf(&buf, "%s: checkout %s",
>  					    getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
>  					    options.switch_to);
> -				if (reset_head(&oid, "checkout",
> +				if (reset_head(&options.orig_head, "checkout",
>  					       options.head_name,
>  					       RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
>  					       NULL, buf.buf) < 0) {
> --
> 2.24.1
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'
  2020-01-21 19:32 [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to' Alban Gruin
  2020-01-22 14:00 ` Johannes Schindelin
@ 2020-01-22 20:47 ` Junio C Hamano
  2020-02-14 20:43   ` Alban Gruin
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2020-01-22 20:47 UTC (permalink / raw)
  To: Alban Gruin; +Cc: git, phillip.wood, Johannes Schindelin

Alban Gruin <alban.gruin@gmail.com> writes:

> When `options.switch_to' is set, `options.orig_head' is populated right
> after.  Therefore, there is no need to parse `switch_to' again.
>
> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> ---
>  builtin/rebase.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)

Sounds good.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'
  2020-01-22 20:47 ` Junio C Hamano
@ 2020-02-14 20:43   ` Alban Gruin
  0 siblings, 0 replies; 4+ messages in thread
From: Alban Gruin @ 2020-02-14 20:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, phillip.wood, Johannes Schindelin

Hi Junio,

Le 22/01/2020 à 21:47, Junio C Hamano a écrit :
> Alban Gruin <alban.gruin@gmail.com> writes:
> 
>> When `options.switch_to' is set, `options.orig_head' is populated right
>> after.  Therefore, there is no need to parse `switch_to' again.
>>
>> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
>> ---
>>  builtin/rebase.c | 10 +---------
>>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> Sounds good.
> 

Did this patch fell through the cracks?

Alban



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-14 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 19:32 [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to' Alban Gruin
2020-01-22 14:00 ` Johannes Schindelin
2020-01-22 20:47 ` Junio C Hamano
2020-02-14 20:43   ` Alban Gruin

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