{"thread":{"id":"52674","subject":"[PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'","startedAt":"2020-01-21T19:35:22Z","lastAt":"2020-02-14T20:43:42Z","messageCount":4,"participants":["Alban Gruin","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"390196","messageId":"20200121193226.24297-1-alban.gruin@gmail.com","threadId":"52674","inReplyTo":null,"subject":"[PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'","fromName":"Alban Gruin","fromEmail":"alban.gruin@gmail.com","sentAt":"2020-01-21T19:32:26Z","receivedAt":"2020-01-21T19:35:22Z","isPatch":true,"sender":{"key":"alban.gruin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6310153?v=4"},"body":"When `options.switch_to' is set, `options.orig_head' is populated right\nafter.  Therefore, there is no need to parse `switch_to' again.\n\nSigned-off-by: Alban Gruin <alban.gruin@gmail.com>\n---\n builtin/rebase.c | 10 +---------\n 1 file changed, 1 insertion(+), 9 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 6154ad8fa5..16d2ec7ebc 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -2056,19 +2056,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\tif (!(options.flags & REBASE_FORCE)) {\n \t\t\t/* Lazily switch to the target branch if needed... */\n \t\t\tif (options.switch_to) {\n-\t\t\t\tstruct object_id oid;\n-\n-\t\t\t\tif (get_oid(options.switch_to, &oid) < 0) {\n-\t\t\t\t\tret = !!error(_(\"could not parse '%s'\"),\n-\t\t\t\t\t\t      options.switch_to);\n-\t\t\t\t\tgoto cleanup;\n-\t\t\t\t}\n-\n \t\t\t\tstrbuf_reset(&buf);\n \t\t\t\tstrbuf_addf(&buf, \"%s: checkout %s\",\n \t\t\t\t\t    getenv(GIT_REFLOG_ACTION_ENVIRONMENT),\n \t\t\t\t\t    options.switch_to);\n-\t\t\t\tif (reset_head(&oid, \"checkout\",\n+\t\t\t\tif (reset_head(&options.orig_head, \"checkout\",\n \t\t\t\t\t       options.head_name,\n \t\t\t\t\t       RESET_HEAD_RUN_POST_CHECKOUT_HOOK,\n \t\t\t\t\t       NULL, buf.buf) < 0) {\n-- \n2.24.1\n\n"},{"id":"390232","messageId":"nycvar.QRO.7.76.6.2001221500210.46@tvgsbejvaqbjf.bet","threadId":"52674","inReplyTo":"20200121193226.24297-1-alban.gruin@gmail.com","subject":"Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-01-22T14:00:44Z","receivedAt":"2020-01-22T14:01:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Alban,\n\nOn Tue, 21 Jan 2020, Alban Gruin wrote:\n\n> When `options.switch_to' is set, `options.orig_head' is populated right\n> after.  Therefore, there is no need to parse `switch_to' again.\n>\n> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>\n\nACK!\nDscho\n\n> ---\n>  builtin/rebase.c | 10 +---------\n>  1 file changed, 1 insertion(+), 9 deletions(-)\n>\n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 6154ad8fa5..16d2ec7ebc 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -2056,19 +2056,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>  \t\tif (!(options.flags & REBASE_FORCE)) {\n>  \t\t\t/* Lazily switch to the target branch if needed... */\n>  \t\t\tif (options.switch_to) {\n> -\t\t\t\tstruct object_id oid;\n> -\n> -\t\t\t\tif (get_oid(options.switch_to, &oid) < 0) {\n> -\t\t\t\t\tret = !!error(_(\"could not parse '%s'\"),\n> -\t\t\t\t\t\t      options.switch_to);\n> -\t\t\t\t\tgoto cleanup;\n> -\t\t\t\t}\n> -\n>  \t\t\t\tstrbuf_reset(&buf);\n>  \t\t\t\tstrbuf_addf(&buf, \"%s: checkout %s\",\n>  \t\t\t\t\t    getenv(GIT_REFLOG_ACTION_ENVIRONMENT),\n>  \t\t\t\t\t    options.switch_to);\n> -\t\t\t\tif (reset_head(&oid, \"checkout\",\n> +\t\t\t\tif (reset_head(&options.orig_head, \"checkout\",\n>  \t\t\t\t\t       options.head_name,\n>  \t\t\t\t\t       RESET_HEAD_RUN_POST_CHECKOUT_HOOK,\n>  \t\t\t\t\t       NULL, buf.buf) < 0) {\n> --\n> 2.24.1\n>\n>\n"},{"id":"390244","messageId":"xmqq1rrr6ww2.fsf@gitster-ct.c.googlers.com","threadId":"52674","inReplyTo":"20200121193226.24297-1-alban.gruin@gmail.com","subject":"Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-01-22T20:47:57Z","receivedAt":"2020-01-22T20:48:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alban Gruin <alban.gruin@gmail.com> writes:\n\n> When `options.switch_to' is set, `options.orig_head' is populated right\n> after.  Therefore, there is no need to parse `switch_to' again.\n>\n> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>\n> ---\n>  builtin/rebase.c | 10 +---------\n>  1 file changed, 1 insertion(+), 9 deletions(-)\n\nSounds good.\n"},{"id":"391796","messageId":"df9ede1c-f657-d96f-2d4c-479245f2a2d8@gmail.com","threadId":"52674","inReplyTo":"xmqq1rrr6ww2.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'","fromName":"Alban Gruin","fromEmail":"alban.gruin@gmail.com","sentAt":"2020-02-14T20:43:32Z","receivedAt":"2020-02-14T20:43:42Z","isPatch":true,"sender":{"key":"alban.gruin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6310153?v=4"},"body":"Hi Junio,\n\nLe 22/01/2020 à 21:47, Junio C Hamano a écrit :\n> Alban Gruin <alban.gruin@gmail.com> writes:\n> \n>> When `options.switch_to' is set, `options.orig_head' is populated right\n>> after.  Therefore, there is no need to parse `switch_to' again.\n>>\n>> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>\n>> ---\n>>  builtin/rebase.c | 10 +---------\n>>  1 file changed, 1 insertion(+), 9 deletions(-)\n> \n> Sounds good.\n> \n\nDid this patch fell through the cracks?\n\nAlban\n\n\n"}]}