Subject: Re: Bug with rebase and commit hashes

From: Michael McClimon <[email-masked]>
Date: Fri, 11 Mar 2022 22:10:28 -0500

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
[email-masked]