Denton Liu <liu.denton@xxxxxxxxx> writes: > > Range-diff against v5: > 1: a99a45cb6f ! 1: 3008ce8deb t7700: consolidate code into test_no_missing_in_packs() > @@ Commit message > Refactor the resulting extraction so that if any git commands fail, > their return codes are not silently lost. > > - We were using sed to filter lines. Although not incorrect, this is > - exactly what grep is built for. Replace this invocation of sed with grep > - so that we use the correct tool for the job. > - > 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 > - sort the files then use `comm -23` so that finding missing lines from > - the original file is done more efficiently. > + 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. > > @@ t/t7700-repack.sh: test_description='git repack works correctly' > + myidx=$(ls -1 .git/objects/pack/*.idx) && > + test_path_is_file "$myidx" && > + git verify-pack -v alt_objects/pack/*.idx >orig.raw && > -+ grep "^[0-9a-f]\{40\}" orig.raw | cut -d" " -f1 | sort >orig && > ++ sed -n -e "s/^\([0-9a-f]\{40\}\).*/\1/p" orig.raw | sort >orig && > + git verify-pack -v $myidx >dest.raw && > + cut -d" " -f1 dest.raw | sort >dest && > + comm -23 orig dest >missing && OK. > 2: f79240e937 = 2: f3a0470edc t7700: consolidate code into test_has_duplicate_object() > 3: 632a62f6e9 = 3: c34477a5a9 t7700: replace egrep with grep > 4: bf70cc5a0d ! 4: 113f375192 t7700: make references to SHA-1 generic > @@ t/t7700-repack.sh: test_description='git repack works correctly' > myidx=$(ls -1 .git/objects/pack/*.idx) && > test_path_is_file "$myidx" && > git verify-pack -v alt_objects/pack/*.idx >orig.raw && > -- grep "^[0-9a-f]\{40\}" orig.raw | cut -d" " -f1 | sort >orig && > -+ grep "^$OID_REGEX" orig.raw | cut -d" " -f1 | sort >orig && > +- sed -n -e "s/^\([0-9a-f]\{40\}\).*/\1/p" orig.raw | sort >orig && > ++ sed -n -e "s/^\($OID_REGEX\).*/\1/p" orig.raw | sort >orig && Looking really good. Thanks for following through. Will replace and queue. Hopefully this round is now ready for 'next'. Knock knock...