Skip to content

Commit 1c0cc75

Browse files
Ramsay Jonesgitster
authored andcommitted
test-lib.sh: Fix some shell coding style violations
Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69915d8 commit 1c0cc75

File tree

1 file changed

+38
-22
lines changed

1 file changed

+38
-22
lines changed

t/test-lib.sh

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ unset CDPATH
100100
unset GREP_OPTIONS
101101

102102
case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
103-
1|2|true)
104-
echo "* warning: Some tests will not work if GIT_TRACE" \
105-
"is set as to trace on STDERR ! *"
106-
echo "* warning: Please set GIT_TRACE to something" \
107-
"other than 1, 2 or true ! *"
108-
;;
103+
1|2|true)
104+
echo "* warning: Some tests will not work if GIT_TRACE" \
105+
"is set as to trace on STDERR ! *"
106+
echo "* warning: Please set GIT_TRACE to something" \
107+
"other than 1, 2 or true ! *"
108+
;;
109109
esac
110110

111111
# Convenience
@@ -172,17 +172,23 @@ do
172172
esac
173173
done
174174

175-
if test -n "$color"; then
175+
if test -n "$color"
176+
then
176177
say_color () {
177178
(
178179
TERM=$ORIGINAL_TERM
179180
export TERM
180181
case "$1" in
181-
error) tput bold; tput setaf 1;; # bold red
182-
skip) tput bold; tput setaf 2;; # bold green
183-
pass) tput setaf 2;; # green
184-
info) tput setaf 3;; # brown
185-
*) test -n "$quiet" && return;;
182+
error)
183+
tput bold; tput setaf 1;; # bold red
184+
skip)
185+
tput bold; tput setaf 2;; # bold green
186+
pass)
187+
tput setaf 2;; # green
188+
info)
189+
tput setaf 3;; # brown
190+
*)
191+
test -n "$quiet" && return;;
186192
esac
187193
shift
188194
printf "%s" "$*"
@@ -298,7 +304,8 @@ test_run_ () {
298304
then
299305
test_eval_ "$test_cleanup"
300306
fi
301-
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
307+
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"
308+
then
302309
echo ""
303310
fi
304311
return "$eval_ret"
@@ -346,7 +353,8 @@ test_at_end_hook_ () {
346353
test_done () {
347354
GIT_EXIT_OK=t
348355

349-
if test -z "$HARNESS_ACTIVE"; then
356+
if test -z "$HARNESS_ACTIVE"
357+
then
350358
test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
351359
mkdir -p "$test_results_dir"
352360
test_results_path="$test_results_dir/${0%.sh}-$$.counts"
@@ -377,7 +385,8 @@ test_done () {
377385
# Maybe print SKIP message
378386
[ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
379387

380-
if test $test_external_has_tap -eq 0; then
388+
if test $test_external_has_tap -eq 0
389+
then
381390
say_color pass "# passed all $msg"
382391
say "1..$test_count$skip_all"
383392
fi
@@ -391,7 +400,8 @@ test_done () {
391400
exit 0 ;;
392401

393402
*)
394-
if test $test_external_has_tap -eq 0; then
403+
if test $test_external_has_tap -eq 0
404+
then
395405
say_color error "# failed $test_failure among $msg"
396406
say "1..$test_count"
397407
fi
@@ -471,22 +481,26 @@ then
471481
PATH=$GIT_VALGRIND/bin:$PATH
472482
GIT_EXEC_PATH=$GIT_VALGRIND/bin
473483
export GIT_VALGRIND
474-
elif test -n "$GIT_TEST_INSTALLED" ; then
484+
elif test -n "$GIT_TEST_INSTALLED"
485+
then
475486
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
476487
error "Cannot run git from $GIT_TEST_INSTALLED."
477488
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
478489
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
479490
else # normal case, use ../bin-wrappers only unless $with_dashes:
480491
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
481-
if ! test -x "$git_bin_dir/git" ; then
482-
if test -z "$with_dashes" ; then
492+
if ! test -x "$git_bin_dir/git"
493+
then
494+
if test -z "$with_dashes"
495+
then
483496
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
484497
fi
485498
with_dashes=t
486499
fi
487500
PATH="$git_bin_dir:$PATH"
488501
GIT_EXEC_PATH=$GIT_BUILD_DIR
489-
if test -n "$with_dashes" ; then
502+
if test -n "$with_dashes"
503+
then
490504
PATH="$GIT_BUILD_DIR:$PATH"
491505
fi
492506
fi
@@ -521,7 +535,8 @@ then
521535
}
522536
fi
523537

524-
if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
538+
if ! test -x "$GIT_BUILD_DIR"/test-chmtime
539+
then
525540
echo >&2 'You need to build test-chmtime:'
526541
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
527542
exit 1
@@ -544,7 +559,8 @@ rm -fr "$test" || {
544559
HOME="$TRASH_DIRECTORY"
545560
export HOME
546561

547-
if test -z "$TEST_NO_CREATE_REPO"; then
562+
if test -z "$TEST_NO_CREATE_REPO"
563+
then
548564
test_create_repo "$test"
549565
else
550566
mkdir -p "$test"

0 commit comments

Comments
 (0)