From: Patrick Steinhardt Date: Fri, 24 Oct 2025 05:44:57 GMT Subject: Re: [PATCH 3/8] builtin/maintenance: introduce "geometric-repack" task Message-ID: In-Reply-To: On Thu, Oct 23, 2025 at 03:19:47PM -0400, Taylor Blau wrote: > On Tue, Oct 21, 2025 at 03:00:31PM +0200, Patrick Steinhardt wrote: > > > > + # Verify that the number of packfiles matches our expectation. > > > > + ls -l .git/objects/pack/*.pack >packfiles && > > > > + test_line_count = "$EXPECTED_PACKS" packfiles && > > > > + > > > > + # And verify that there are no loose objects anymore. > > > > + cat >expect <<-\EOF && > > > > + info > > > > + pack > > > > + EOF > > > > + ls .git/objects >actual && > > > > > > I wonder if there is an easier way to check for loose objects here that > > > doesn't require you to know that the "info" and "pack" directories > > > exist. Perhaps something like: > > > > > > test_stdout_line_count = 0 find .git/objects/?? -type f > > > > > > , or even > > > > > > find .git/objects/?? -type f >loose.objs && > > > test_must_be_empty loose.objs > > > > This doesn't work though in case there is not even a single sharding > > directory: > > > > find: '.git/objects/??': No such file or directory > > > > I didn't really have any other idea for now to do this. > > Mmm, good point. What about using 'git count-objects -v' directly? > > test_loose_object_nr() { > local nr="$1" && > git count-objects -v >count && > grep '^count $nr$" count > } I guess that works. We can even simplify this case as we really only want to check that there are no loose objects at all: git count-objects -v >count && test_grep '^count: 0$' count Thanks! Patrick