From: Phillip Wood <phillip.wood123@gmail.com>
To: Taylor Blau <me@ttaylorr.com>, phillip.wood@dunelm.org.uk
Cc: Christopher Fretz <cfretz@icloud.com>, git@vger.kernel.org
Subject: Re: git rebase --root bug
Date: Fri, 12 May 2023 16:18:39 +0100 [thread overview]
Message-ID: <a6c6d3a4-433d-f275-e31c-4eece062722c@gmail.com> (raw)
In-Reply-To: <ZF0U6tneDjLfGxf1@nand.local>
Hi Taylor
On 11/05/2023 17:16, Taylor Blau wrote:
> On Thu, May 11, 2023 at 03:21:11PM +0100, Phillip Wood wrote:
>> The cause of the problem is that --root creates an empty commit (known as
>> "squash_onto" in the code) which it uses as the "onto" commit. When it picks
>> the first commit in the todo list the "onto" commit is amended and so is
>> unreachable when the reflog is expired above. I think the best fix would be
>> to stop pretending that we have a real "onto" commit when --root is used
>> without --onto and either store "new root" .git/rebase-merge/onto or not
>> create that file at all.
>
> Wouldn't it suffice to consider the squash_onto commit as reachable the
> same way we do for `--indexed-objects`?
We could do that rather than clean up the implementation of --root. We
should definitely consider the commit stored in
.git/rebase-merge/orig-head to be reachable as the following test fails
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index ff0afad63e..8ac5e2eec6 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -66,6 +66,19 @@ test_expect_success 'setup' '
SHELL=
export SHELL
+test_expect_success 'orig-head is not garbage collected' '
+ git checkout --detach &&
+ test_commit --no-tag x &&
+ (
+ set_fake_editor &&
+ FAKE_LINES="1 edit 2" git rebase -i @~2
+ ) &&
+ git reset @^ &&
+ git reflog expire --expire-unreachable=now &&
+ git gc --prune=now &&
+ git rebase --abort
+'
+
test_expect_success 'rebase --keep-empty' '
git checkout -b emptybranch primary &&
git commit --allow-empty -m "empty" &&
I'm not familiar with the gc code, does it use the --indexed-objects
option of "git rev-list"?
Best Wishes
Phillip
prev parent reply other threads:[~2023-05-12 15:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 20:08 git rebase --root bug Christopher Fretz
2023-05-10 20:35 ` Kristoffer Haugsbakk
2023-05-11 4:07 ` Christopher Fretz
2023-05-11 14:21 ` Phillip Wood
2023-05-11 16:16 ` Taylor Blau
2023-05-11 19:52 ` Christopher Fretz
2023-05-12 15:18 ` Phillip Wood [this message]
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=a6c6d3a4-433d-f275-e31c-4eece062722c@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=cfretz@icloud.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).