Re: [PATCH] pack-redundant: fix crash when one packfile in repo
- From
Jeff King <peff@peff.net>
- Date
- Dec 16, 2020, 18:46 UTC
- Message-ID
- <X9pWDRAn7GmJgt7Z@coredump.intra.peff.net>
- In-Reply-To
- <20201216100952.16890-1-worldhello.net@gmail.com>
On Wed, Dec 16, 2020 at 05:09:52AM -0500, Jiang Xin wrote:
> Command `git pack-redundant --all` will crash if there is only one > packfile in the repository. This is because, if there is only one > packfile in local_packs, `cmp_local_packs` will do nothing and will > leave `pl->unique_objects` as uninitialized.
Thanks, that makes sense. And I'm glad I waited to get the opinion of somebody much more clueful. Mine was a band-aid, but yours is hitting the root cause and will help any other downstream code that assumes unique_objects isn't NULL.
> builtin/pack-redundant.c | 6 ++++ > t/t5323-pack-redundant.sh | 65 +++++++++++++++++++++++++++++----------
The new test coverage makes sense, I think, though as Junio noted, it should be done independent of the $git_pack_redundant change (which will also make the diff a lot easier to review).
-Peff