t7700: consolidate code into test_no_missing_in_packs()
commitae475afc0f8685607e2de838db7fb4bee7934d4d
authorDenton Liu <liu.denton@gmail.com>
Wed, 4 Dec 2019 22:03:09 +0000 (4 14:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Dec 2019 22:25:05 +0000 (4 14:25 -0800)
treeef1cab27d567a94ea1d7793d99966e8f152af52d
parent17a4ae92eaa2f9614d739c11c3b60932a0f272b9
t7700: consolidate code into test_no_missing_in_packs()

The code to test that objects were not missing from the packfile was
duplicated many times. Extract the duplicated code into
test_no_missing_in_packs() and use that instead.

Refactor the resulting extraction so that if any git commands fail,
their return codes are not silently lost.

Instead of verifying each file of `alt_objects/pack/*.idx` individually
in a for-loop, batch them together into one verification step.

The original testing construct was O(n^2): it used a grep in a loop to
test whether any objects were missing in the packfile. Rewrite this to
extract the hash using sed or cut, sort the files, then use `comm -23`
so that finding missing lines from the original file is done more
efficiently.

While we're at it, add a space to `commit_and_pack ()` for style.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7700-repack.sh