This is a follow-up from my previous email about the possibility of not fetching when we know that we're fetching a commit [1]. I had to refactor a few things mostly due to replace objects, so the number of patches might be larger than you would expect. I tried to keep each patch small and easy to understand, though. Patches 1-3 contain some forward-compatibility and refactoring changes, and patch 4 contains the actual logic change. [1] https://lore.kernel.org/git/20221124004205.1777255-1-jonathantanmy@xxxxxxxxxx/ Jonathan Tan (4): object-file: reread object with exact same args object-file: refactor corrupt object diagnosis object-file: refactor replace object lookup commit: don't lazy-fetch commits commit.c | 18 ++++++++++++++-- object-file.c | 57 ++++++++++++++++++++++++++++++++++---------------- object-store.h | 10 +++++++++ 3 files changed, 65 insertions(+), 20 deletions(-) -- 2.38.1.584.g0f3c55d4c2-goog