gc-util-functions.sh: adopt single-object loose packs
commitce65b2da21c7f0254b3785f0c90b3f174a2082bc
authorKyle J. McKay <mackyle@gmail.com>
Thu, 11 Jun 2020 01:30:20 +0000 (10 18:30 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 11 Jun 2020 01:30:20 +0000 (10 18:30 -0700)
treed4ce59666504498d0a896e62f1df6e723ceb7927
parentf59bb63746924d44aecc1a0c65902292736360c6
gc-util-functions.sh: adopt single-object loose packs

The `git hash-object -w` utility has an "interesting" behavior in
that if it's hashing a regular file (S_ISREG) either passed directly
as the filename or as an open file handle (via `--stdin`), and the
actual size of the file exceeds `core.bigFileThreshold`, then it
*always creates a new single-object pack*!

(Unless, of course, the object already exists in the repository.)

When `git-svn fetch` creates new blobs, it first writes the data
to a temporary file and then passes that to `git hash-object -w`
(using the `--stdin-paths` option).

What this means is that whenever `git-svn fetch` encounters a remote
"blob" that exceeds `core.bigFileThreshold` it will be stored
directly into a new single-object pack of its own if it does not
already exist in the repository.

Adopt any such single-object packs as "loose packs" (i.e. they have
an "_l" infix right before the ".pack" suffix) to make them participate
in pack combining operations.

Make this relatively painless for callers by having the
`pack_incremental_loose_objects` function perform this "adoption"
right before it checks for too many "loose" packs.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/gc-util-functions.sh