Message ID | 68ee769121195eb61bb51fd6a27d22a8dddb13b6.1629263759.git.congdanhqx@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | t6300: clear warning when running without gpg | expand |
Đoàn Trần Công Danh <congdanhqx@gmail.com> writes: > In test_atom(), we're piping the output of cat-file to tail(1), > thus, losing its exit status. > > Let's use a temporary file to preserve git exit status code. > > Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> > --- > t/t6300-for-each-ref.sh | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh > index 93126341b3..cc0f5b6627 100755 > --- a/t/t6300-for-each-ref.sh > +++ b/t/t6300-for-each-ref.sh > @@ -66,7 +66,9 @@ test_atom() { > case $type in > tag) > # We cannot use $3 as it expects sanitize_pgp to run > - expect=$(git cat-file tag $ref | tail -n +6 | wc -c) ;; > + git cat-file tag $ref >out && > + expect=$(tail -n +6 <out | wc -c) && It is not wrong per-se, but do we need a redirect '<' here? "tail" takes filename(s) on the command line, but is there a reason to feed the contents from the standard input? > + rm -f out ;; > tree | blob) > expect="" ;; > commit)
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 93126341b3..cc0f5b6627 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -66,7 +66,9 @@ test_atom() { case $type in tag) # We cannot use $3 as it expects sanitize_pgp to run - expect=$(git cat-file tag $ref | tail -n +6 | wc -c) ;; + git cat-file tag $ref >out && + expect=$(tail -n +6 <out | wc -c) && + rm -f out ;; tree | blob) expect="" ;; commit)
In test_atom(), we're piping the output of cat-file to tail(1), thus, losing its exit status. Let's use a temporary file to preserve git exit status code. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> --- t/t6300-for-each-ref.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)