Re: Bug with rebase and commit hashes
- From
Michael McClimon <michael@mcclimon.org>
- Date
- Mar 12, 2022, 03:10 UTC
- Message-ID
- <YiwPJD39+/hnu36j@newk>
- In-Reply-To
- <036EAEE4-D957-41F2-8B17-3AD7B2E49611@gmail.com>
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); 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