diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2022-12-14 22:17:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-15 03:05:55 +0300 |
commit | 7e2ad1cda2759a14f7b046c4c82e2418f8af878c (patch) | |
tree | 7b72fd4d3cbdf76ba4ec26b9b98b97688d92f0c7 /compat | |
parent | 9e59b38c88cdd79964cc92860906a0737bee3797 (diff) |
commit: don't lazy-fetch commits
When parsing commits, fail fast when the commit is missing or
corrupt, instead of attempting to fetch them. This is done by inlining
repo_read_object_file() and setting the flag that prevents fetching.
This is motivated by a situation in which through a bug (not necessarily
through Git), there was corruption in the object store of a partial
clone. In this particular case, the problem was exposed when "git gc"
tried to expire reflogs, which calls repo_parse_commit(), which triggers
fetches of the missing commits.
(There are other possible solutions to this problem including passing an
argument from "git gc" to "git reflog" to inhibit all lazy fetches, but
I think that this fix is at the wrong level - fixing "git reflog" means
that this particular command works fine, or so we think (it will fail if
it somehow needs to read a legitimately missing blob, say, a .gitmodules
file), but fixing repo_parse_commit() will fix a whole class of bugs.)
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
0 files changed, 0 insertions, 0 deletions