Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2022-03-17 21:24:47 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-18 03:44:38 +0300
commit2a69ff09d5654de31361365e3faf9f8495f03ed7 (patch)
tree8fb41bab337ed067f76a2e75883345fde0e277dd /shallow.c
parent74cc1aa55f30ed76424a0e7226ab519aa6265061 (diff)
shallow: reset commit grafts when shallow is reset
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. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/shallow.c b/shallow.c
index 71e5876f37..e158be58b0 100644
--- a/shallow.c
+++ b/shallow.c
@@ -90,6 +90,7 @@ static void reset_repository_shallow(struct repository *r)
{
r->parsed_objects->is_shallow = -1;
stat_validity_clear(r->parsed_objects->shallow_stat);
+ reset_commit_grafts(r);
}
int commit_shallow_file(struct repository *r, struct shallow_lock *lk)