summaryrefslogtreecommitdiff
path: root/t/perf/p5303-many-packs.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-01-29 20:04:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-29 23:13:54 (GMT)
commitf08b6c553d5b0e5a50176a176ad9061130fb9b4b (patch)
tree5fb0c21964c785d99dbf89713e0b8ac0d9c2c0aa /t/perf/p5303-many-packs.sh
parent71ca53e8125e36efbda17293c50027d31681a41f (diff)
downloadgit-f08b6c553d5b0e5a50176a176ad9061130fb9b4b.zip
git-f08b6c553d5b0e5a50176a176ad9061130fb9b4b.tar.gz
git-f08b6c553d5b0e5a50176a176ad9061130fb9b4b.tar.bz2
p5303: avoid sed GNU-ism
Using "1~5" isn't portable. Nobody seems to have noticed, since perhaps people don't tend to run the perf suite on more exotic platforms. Still, it's better to set a good example. We can use: perl -ne 'print if $. % 5 == 1' instead. But we can further observe that perl does a good job of the other parts of this pipeline, and fold the whole thing together. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/p5303-many-packs.sh')
-rwxr-xr-xt/perf/p5303-many-packs.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh
index f4c2ab0..ce0c42c 100755
--- a/t/perf/p5303-many-packs.sh
+++ b/t/perf/p5303-many-packs.sh
@@ -21,10 +21,14 @@ repack_into_n () {
mkdir staging &&
git rev-list --first-parent HEAD |
- sed -n '1~5p' |
- head -n "$1" |
- perl -e 'print reverse <>' \
- >pushes
+ perl -e '
+ my $n = shift;
+ while (<>) {
+ last unless @commits < $n;
+ push @commits, $_ if $. % 5 == 1;
+ }
+ print reverse @commits;
+ ' "$1" >pushes
# create base packfile
head -n 1 pushes |