Thread (62 messages) 62 messages, 4 authors, 2025-10-27

Re: [PATCH 3/8] builtin/maintenance: introduce "geometric-repack" task

From: Patrick Steinhardt <hidden>
Date: 2025-10-24 05:45:09

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:
quoted
quoted
quoted
+	# 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help