Re: bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Apr 28, 2025, 19:23 UTC
- Message-ID
- <20250428192320.3595509-1-jonathantanmy@google.com>
- In-Reply-To
- <CABPp-BFiLURYmELQ1omyPJ+49cVxk1h4rPYj42zMwGUW-NUUGQ@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
> Cc'ing the author of that commit for his comments.
I took a look. I'm not sure why I made the assumption that should_include_obj() would only ever be called on objects in the repo - in process_tree() in list-objects.c, the case of a missing object is handled only after should_include_obj() is called. Looking back at the earliest mention of this on the list [1] I don't see any clues either.
In any case, the fix is probably to change it so that should_include_obj() returns 0 if the object is absent.
Having said that, I couldn't come up with a test that exercises this failure mode. Nik, do you have a minimal repo that reproduces this error? If yes, if you could contribute a test in the form of the 'after fetching descendants of non-promisor commits, gc works' test in t5616, that would help prevent regressions in the future.
[1] https://lore.kernel.org/git/fb2c202591b466eea33b4585e47b70e9086603bb.1729549127.git.jonathantanmy@google.com/