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>
Jeff King committed
Jan 29, 2021 at 15:04 UTC
f08b6c553d5b0e5a50176a176ad9061130fb9b4b
1 file changed
+8
-4
t/perf/p5303-many-packs.sh
+8
-4
@@ -21,10 +21,14 @@ repack_into_n () {
21
mkdir staging &&
22
23
git rev-list --first-parent HEAD |
24
- sed -n '1~5p' |
25
- head -n "$1" |
26
- perl -e 'print reverse <>' \
27
- >pushes
24
+ perl -e '
25
+ my $n = shift;
26
+ while (<>) {
27
+ last unless @commits < $n;
28
+ push @commits, $_ if $. % 5 == 1;
29
+ }
30
+ print reverse @commits;
31
+ ' "$1" >pushes
32
33
# create base packfile
34
head -n 1 pushes |