From: Derrick Stolee <firstname.lastname@example.org>
To: "SZEDER Gábor" <email@example.com>,
"Derrick Stolee via GitGitGadget" <firstname.lastname@example.org>
Cc: email@example.com, firstname.lastname@example.org, email@example.com,
Derrick Stolee <firstname.lastname@example.org>,
Junio C Hamano <email@example.com>
Subject: Re: [PATCH v2 2/2] commit-graph: fix writing first commit-graph during fetch
Date: Thu, 24 Oct 2019 06:39:51 -0400 [thread overview]
Message-ID: <firstname.lastname@example.org> (raw)
On 10/23/2019 11:04 AM, SZEDER Gábor wrote:
> On Wed, Oct 23, 2019 at 01:01:35PM +0000, Derrick Stolee via GitGitGadget wrote:
>> You may ask: did this feature ever work at all? Yes, it did, as long as
>> you had a commit-graph covering all of your local refs. My testing was
>> unfortunately limited to this scenario. The UNINTERESTING commits are
>> always part of the "old" commit-graph, and when we add new commits to a
>> top layer of the commit-graph chain those are not needed. If we happen
>> to merge layers of the chain, then the commits are added as a list, not
>> using a commit walk. Further, the test added for this config option in
>> t5510-fetch.sh uses local filesystem clones, which somehow avoids this
> Does this last sentence still holds, given that a submodule plays a
> crucial role in triggering this bug? I think it either doesn't, or
> I still don't completely understand the situation.
This does not apply anymore. I forgot to delete it.
>> I tested running clear_commit_marks_many() to clear the UNINTERESTING
>> flag inside close_reachable(), but the tips did not have the flag, so
>> that did nothing.
>> It turns out that the calculate_changed_submodule_paths() method is at
>> fault. Thanks, Peff, for pointing out this detail! More specifically,
>> for each submodule, the collect_changed_submodules() runs a revision
>> walk to essentially do file-history on the list of submodules. That
>> revision walk marks commits UNININTERESTING if they are simiplified away
>> by not changing the submodule.
>> Instead, I finally arrived on the conclusion that I should use a flag
>> that is not used in any other part of the code. In commit-reach.c, a
>> number of flags were defined for commit walk algorithms. The REACHABLE
>> flag seemed like it made the most sense, and it seems it was not
>> actually used in the file. The REACHABLE flag was used in early versions
>> of commit-reach.c, but was removed by 4fbcca4 (commit-reach: make
>> can_all_from_reach... linear, 2018-07-20).
>> Add the REACHABLE flag to commit-graph.c and use it instead of
>> UNINTERESTING in close_reachable(). This fixes the bug in manual
> I'm inclined to agree that using a flag that is not used anywhere else
> is the safest thing to do, and at -rcX time safest is good. I'm not
> sure whether it's the right thing to do in the long term, though.
> Furthermore, calling this flag REACHABLE is misleading, because the
> code actually means SEEN.
> Consider the following sequence of commands:
> # Create a pack with two commits
> $ git commit --allow-empty -m one &&
> $ git commit --allow-empty -m two &&
> $ git repack -ad &&
> # Make one of those commits unreachable
> $ git reset --hard HEAD^ &&
> # Not even from reflogs!
> $ git reflog expire --expire-unreachable=now --all
> # Now write a commit-graph from that pack file
> $ git commit-graph write
> Computing commit graph generation numbers: 100% (2/2), done.
> It added two commits to the commit-graph, although one of them is
> clearly not reachable anymore, so marking it as REACHABLE while
> enumerating all commits feels wrong.
Since you are using "git commit-graph write", the command is scanning
all pack-files for commits to include. Even in this case, the
close_reachable() method needs to walk to see if any commits are missing.
(It could be that the root commit is loose for some strange reason.)
In this case, we are marking REACHABLE the commits that can be reached
from our "starting" commits. In your example we start with every commit.
If you had used `git commit-graph write --stdin-packs` and provided a
small pack name over stdin, the concept would be similar and even more
pronounced: the pack (perhaps downloaded via 'fetch') is not likely to
contain every commit, so we need to walk all reachable commits from
I'll have a v3 today with the requested fixes.
next prev parent reply other threads:[~2019-10-24 10:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 17:28 [PATCH 0/1] [v2.24.0-rc0 BUG] fetch.writeCommitGraph fails on first fetch Derrick Stolee via GitGitGadget
2019-10-22 17:28 ` [PATCH 1/1] commit-graph: fix writing first commit-graph during fetch Derrick Stolee via GitGitGadget
2019-10-22 20:33 ` Jeff King
2019-10-22 21:45 ` Jeff King
2019-10-22 23:35 ` SZEDER Gábor
2019-10-23 0:35 ` Derrick Stolee
2019-10-23 0:48 ` Jeff King
2019-10-23 1:22 ` Jeff King
2019-10-23 13:01 ` [PATCH v2 0/2] [v2.24.0-rc0 BUG] fetch.writeCommitGraph fails on first fetch Derrick Stolee via GitGitGadget
2019-10-23 13:01 ` [PATCH v2 1/2] t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug Derrick Stolee via GitGitGadget
2019-10-23 14:18 ` SZEDER Gábor
2019-10-23 20:46 ` Derrick Stolee
2019-10-24 12:18 ` SZEDER Gábor
2019-10-23 13:01 ` [PATCH v2 2/2] commit-graph: fix writing first commit-graph during fetch Derrick Stolee via GitGitGadget
2019-10-23 15:04 ` SZEDER Gábor
2019-10-24 10:39 ` Derrick Stolee [this message]
2019-10-30 14:31 ` SZEDER Gábor
2019-10-24 12:18 ` [PATCH v3 0/2] [v2.24.0-rc0 BUG] fetch.writeCommitGraph fails on first fetch Derrick Stolee via GitGitGadget
2019-10-24 12:18 ` [PATCH v3 1/2] t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug Derrick Stolee via GitGitGadget
2019-10-24 12:18 ` [PATCH v3 2/2] commit-graph: fix writing first commit-graph during fetch Derrick Stolee via GitGitGadget
2019-10-24 13:40 ` [PATCH v4 0/2] [v2.24.0-rc0 BUG] fetch.writeCommitGraph fails on first fetch Derrick Stolee via GitGitGadget
2019-10-24 13:40 ` [PATCH v4 1/2] t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug Derrick Stolee via GitGitGadget
2019-10-24 13:40 ` [PATCH v4 2/2] commit-graph: fix writing first commit-graph during fetch Derrick Stolee via GitGitGadget
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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 NNTP newsgroup(s).