Hi,
This is my SoC 2019 Microproject: "Avoid pipes in git related commands
in test scripts".
Changes since v2:
- drop changes to other 2 files as suggested by Christian Couder[1]
- rename commit message from "t0000-basic:" to "t0000:"[1]
- use better commit message suggested by Thomas Gummerer[2]
and Christian Couder[3]
- fix the incorrect transformation pointed out by Eric Sunshine[4]
- rename commit message to "fix indentation" as seen in:
25e3d28efd ("submodule.c: fix indentation", 2018-11-28)
d4cddd66d7 ("worktree.c: fix indentation", 2016-01-18)
[v1]: https://public-inbox.org/git/[email protected]/
[v2]: https://public-inbox.org/git/[email protected]/
[1]:
https://public-inbox.org/git/cap8ufd274-idkqpm8-wgxbumcvqjde7bsg2bwa-17twjivn...@mail.gmail.com/
[2]:
https://public-inbox.org/git/[email protected]/
[3]:
https://public-inbox.org/git/CAP8UFD09QZd=6HyB5Om1PfV=67+cvfyqkcplu0tukt48qcc...@mail.gmail.com/
[4]:
https://public-inbox.org/git/capig+csmzrqfrlxoo5ke1uonuxmnyhikr-e6gaq_n6vx3+s...@mail.gmail.com/
Jonathan Chang (3):
t0000: fix indentation
t0000: avoid using pipes
t0000: use test_line_count instead of wc -l
t/t0000-basic.sh | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
Range-diff against v2:
1: dd3e868436 ! 1: c3c231d117 t0000-basic: fix an indentation error
@@ -1,9 +1,11 @@
Author: Jonathan Chang <[email protected]>
- t0000-basic: fix an indentation error
+ t0000: fix indentation
- This is a preparatory step prior to removing the pipes after git
- commands, which discards git's exit code and may mask a crash.
+ Fix indentation of a line containing a pipeline to reduce the
+ noise when refactoring the pipeline in a subsequent commit.
+ This has been wrong since the refactoring done in 1b5b2b641a
+ ("t0000: modernise style", 2012-03-02), but carries no meaning.
Signed-off-by: Jonathan Chang <[email protected]>
2: 5bc591e557 ! 2: 5a3c6e24eb t0000-basic: avoid using pipes
@@ -1,6 +1,6 @@
Author: Jonathan Chang <[email protected]>
- t0000-basic: avoid using pipes
+ t0000: avoid using pipes
The exit code of the upstream in a pipe is ignored thus we should avoid
using it. By writing out the output of the git command to a file, we
can
3: be6a218d83 < -: ---------- t0003-attributes: avoid using pipes
4: 35564c86a1 < -: ---------- t0022-crlf-rename: avoid using pipes
5: 17acadea53 ! 3: bc3dee82a9 t0000-basic: use test_line_count instead of wc
-l
@@ -1,6 +1,6 @@
Author: Jonathan Chang <[email protected]>
- t0000-basic: use test_line_count instead of wc -l
+ t0000: use test_line_count instead of wc -l
Signed-off-by: Jonathan Chang <[email protected]>
@@ -13,8 +13,8 @@
git show --pretty=raw $commit2 >actual &&
- numparent=$(sed -n -e "s/^parent //p" -e "/^author /q" actual | wc -l)
&&
- test $numparent = 1
-+ sed -n -e "s/^parent //p" -e "/^author /q" actual | wc -l >numparent &&
-+ test_line_count = 1 numparent
++ sed -n -e "s/^parent //p" -e "/^author /q" actual >parents &&
++ test_line_count = 1 parents
'
test_expect_success 'update-index D/F conflict' '
@@ -24,8 +24,7 @@
git ls-files path0 >actual &&
- numpath0=$(wc -l <actual) &&
- test $numpath0 = 1
-+ wc -l <actual >numpath0 &&
-+ test_line_count = 1 numpath0
++ test_line_count = 1 actual
'
test_expect_success 'very long name in the index handled sanely' '
--
2.21.0