Re: Bug with rebase and commit hashes
- From
John Cai <johncai86@gmail.com>
- Date
- Mar 12, 2022, 13:32 UTC
- Message-ID
- <B91AE306-6836-47C1-AC99-B06A50BAF61A@gmail.com>
- In-Reply-To
- <YiwPJD39+/hnu36j@newk>
Hey Michael!
On 11 Mar 2022, at 22:10, Michael McClimon wrote:
Show 18 quoted lines
> Thanks both! I had a look at this on the couch this evening, and with the
> caveat that I am not at all a C programmer, I think have a patch that fixes
> it:
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index b29ad2b6..82fb5e2c 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -829,6 +829,8 @@ static int checkout_up_to_date(struct rebase_options *options)
> ropts.oid = &options->orig_head;
> ropts.branch = options->head_name;
> ropts.flags = RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
> + if (!ropts.branch)
> + ropts.flags |= RESET_HEAD_DETACH;
> ropts.head_msg = buf.buf;
> if (reset_head(the_repository, &ropts) < 0)
> ret = error(_("could not switch to %s"), options->switch_to);
>Thanks for looking into this yourself! I actually have a patch out already [1], which is pretty similar to what you suggested.
1. https://lore.kernel.org/git/pull.1226.v2.git.git.1647019492.gitgitgadget@gmail.com/
Show 9 quoted lines
> > I haven't yet run the entire test suite, but I did run all the t*-rebase* > tests, which passed, including Junio's up-thread here. If this seems not > totally off-base, then I'll actually read the "my first contribution" docs and > send in a proper patch and whatnot. > > -- > Michael McClimon > michael@mcclimon.org