public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael McClimon <michael@mcclimon•org>
To: John Cai <johncai86@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: Bug with rebase and commit hashes
Date: Fri, 11 Mar 2022 22:10:28 -0500	[thread overview]
Message-ID: <YiwPJD39+/hnu36j@newk> (raw)
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

  reply	other threads:[~2022-03-12  3:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 16:16 Bug with rebase and commit hashes Michael McClimon
2022-03-10 22:25 ` John Cai
2022-03-10 22:46   ` John Cai
2022-03-12  3:10     ` Michael McClimon [this message]
2022-03-12 13:32       ` John Cai
2022-03-12 14:21         ` Michael McClimon
2022-03-10 22:55   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YiwPJD39+/hnu36j@newk \
    --to=michael@mcclimon$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=johncai86@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox