diff options
| author | Aaron Plattner <aplattner@nvidia.com> | 2026-02-18 10:10:19 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-19 09:02:08 -0800 |
| commit | 0678e01f0211f4e3310f3c01b3425da53aa63677 (patch) | |
| tree | 75bc311b6fb4e200ee5be4758f18f5574af2c161 /t/pack-refs-tests.sh | |
| parent | 67ad42147a7acc2af6074753ebd03d904476118f (diff) | |
| download | git-0678e01f0211f4e3310f3c01b3425da53aa63677.tar.xz | |
t: use test_seq -f and pipes in a few more places
Several tests use a pattern that writes to a temporary file like this:
printf "do something with %d\n" $(test_seq <count>) >tmpfile &&
git do-something --stdin <tmpfile
Other tests use test_seq's -f parameter, but still write to a temporary file:
test_seq -f "do something with %d" <count> >input &&
git do-something --stdin <input
Simplify both of these patterns to
test_seq -f "do something with %d" <count> |
git do-something --stdin
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/pack-refs-tests.sh')
| -rw-r--r-- | t/pack-refs-tests.sh | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/t/pack-refs-tests.sh b/t/pack-refs-tests.sh index 81086c3690..2fdaccb6c7 100644 --- a/t/pack-refs-tests.sh +++ b/t/pack-refs-tests.sh @@ -354,8 +354,8 @@ do # Create 14 additional references, which brings us to # 15 together with the default branch. - printf "create refs/heads/loose-%d HEAD\n" $(test_seq 14) >stdin && - git update-ref --stdin <stdin && + test_seq -f "create refs/heads/loose-%d HEAD" 14 | + git update-ref --stdin && test_path_is_missing .git/packed-refs && git ${pack_refs} --auto --all && test_path_is_missing .git/packed-refs && @@ -379,8 +379,8 @@ do test_line_count = 2 .git/packed-refs && # Create 15 loose references. - printf "create refs/heads/loose-%d HEAD\n" $(test_seq 15) >stdin && - git update-ref --stdin <stdin && + test_seq -f "create refs/heads/loose-%d HEAD" 15 | + git update-ref --stdin && git ${pack_refs} --auto --all && test_line_count = 2 .git/packed-refs && @@ -401,18 +401,14 @@ do # Create 99 packed refs. This should cause the heuristic # to require more than the minimum amount of loose refs. - test_seq 99 | - while read i - do - printf "create refs/heads/packed-%d HEAD\n" $i || return 1 - done >stdin && - git update-ref --stdin <stdin && + test_seq -f "create refs/heads/packed-%d HEAD" 99 | + git update-ref --stdin && git ${pack_refs} --all && test_line_count = 101 .git/packed-refs && # Create 24 loose refs, which should not yet cause us to repack. - printf "create refs/heads/loose-%d HEAD\n" $(test_seq 24) >stdin && - git update-ref --stdin <stdin && + test_seq -f "create refs/heads/loose-%d HEAD" 24 | + git update-ref --stdin && git ${pack_refs} --auto --all && test_line_count = 101 .git/packed-refs && @@ -420,8 +416,8 @@ do # Note that we explicitly do not check for strict # boundaries here, as this also depends on the size of # the object hash. - printf "create refs/heads/addn-%d HEAD\n" $(test_seq 10) >stdin && - git update-ref --stdin <stdin && + test_seq -f "create refs/heads/addn-%d HEAD" 10 | + git update-ref --stdin && git ${pack_refs} --auto --all && test_line_count = 135 .git/packed-refs ) |
