gc.sh: make repack_gfi_packs more robust and scalable
commit25760b5d2f7e3832e803d054e1ed8b39f7d09e04
authorKyle J. McKay <mackyle@gmail.com>
Mon, 25 Apr 2016 22:56:35 +0000 (25 15:56 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 25 Apr 2016 22:56:35 +0000 (25 15:56 -0700)
tree5468aee7232411c7e245adb91f88d22e4ac5f641
parentbcfaee11af451e6f5ee63e467b6bfd5af60dc677
gc.sh: make repack_gfi_packs more robust and scalable

The new pack(s) produced by pack-objects shouldn't experience any
name collision with pre-existing packs, but shouldn't doesn't mean
impossible, so move any such packs aside rather than removing them
assuming they're redundant.

There should only be a handful of fast-import packs that need to
be repacked, but should doesn't mean must.  Alter the gfi_repack_code
so that in the extremely unlikely event of thousands of packs, the
code still works and does not overflow any command line length
limitations.

Finally, after creating a new replacement pack for the fast-import-
created packs, remove the fast-import packs being replaced as they're
redundant and could potentially cause the final gc to produce a less
optimal result.

Also, if pack-objects fails for any reason, return with failure and
do not remove any packs at all.

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