From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, chooglen@google.com
Subject: Re: [PATCH] shallow: reset commit grafts when shallow is reset
Date: Thu, 17 Mar 2022 17:50:52 -0700 [thread overview]
Message-ID: <xmqqsfrgcccz.fsf@gitster.g> (raw)
In-Reply-To: <20220317182448.1633847-1-jonathantanmy@google.com> (Jonathan Tan's message of "Thu, 17 Mar 2022 11:24:47 -0700")
Jonathan Tan <jonathantanmy@google.com> writes:
> When reset_repository_shallow() is called, Git clears its cache of
> shallow information, so that if shallow information is re-requested, Git
> will read fresh data from disk instead of reusing its stale cached data.
> However, the cache of commit grafts is not likewise cleared, even though
> there are commit grafts created from shallow information.
>
> This means that if on-disk shallow information were to be updated and
> then a commit-graft-using codepath were run (for example, a revision
> walk), Git would be using stale commit graft information. This can be
> seen from the test in this patch, in which Git performs a revision walk
> (to check for changed submodules) after a fetch with --update-shallow.
>
> Therefore, clear the cache of commit grafts whenever
> reset_repository_shallow() is called.
Because this helper function resets not just grafts_nr, but
commit_graft_prepared member, the next time prepare_commit_graft()
is called, we'd recover the grafts (not derived from shallows, but
read locally from "info/grafts") from the file, too, which makes it
sound right ;-)
And the implementation looks quite straight-forward.
Will queue. Thanks.
prev parent reply other threads:[~2022-03-18 0:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 18:24 [PATCH] shallow: reset commit grafts when shallow is reset Jonathan Tan
2022-03-17 22:11 ` Glen Choo
2022-03-18 0:50 ` Junio C Hamano [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=xmqqsfrgcccz.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chooglen@google.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.