Re: [PATCH 12/17] builtin/repack.c: support generating a cruft pack
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Feb 23, 2022, 23:37 UTC
- Message-ID
- <YhbFTYmjdci86oY7@nand.local>
- In-Reply-To
- <c9437c89-9258-4034-9886-8a2aec46aa6b@gmail.com>
(Jumping forward a little bit while responding to your review to finish my train of though before I log off for today...)
On Tue, Dec 07, 2021 at 10:38:05AM -0500, Derrick Stolee wrote:
Show 17 quoted lines
> > --- a/t/t5327-pack-objects-cruft.sh > > +++ b/t/t5327-pack-objects-cruft.sh > > @@ -358,4 +358,157 @@ test_expect_success 'expired objects are pruned' ' > > ) > > ' > > > > +test_expect_success 'repack --cruft generates a cruft pack' ' > > + git init repo && > > + test_when_finished "rm -fr repo" && > > + ( > > + cd repo && > > + > > + test_commit reachable && > > + git branch -M main && > > + git checkout --orphan other && > > Here is a way to make objects unreachable!
Yes, indeed. And this is the first spot where we *need* to care about object reachability, because the set of packs that `git repack` passes over stdin to `git pack-objects --cruft` depends on which objects are and aren't reachable.
In the tests that exercise `pack-objects --cruft` directly, we can pretend that certain packs contain only unreachable objects by marking them as "discarded".
Thanks, Taylor