summaryrefslogtreecommitdiff
path: root/t/t3901-i18n-patch.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-25 01:30:17 -0400
committerJunio C Hamano <gitster@pobox.com>2015-03-25 12:49:33 -0700
commitc6587bddc4e8a3ee2eef98a0a5cf15542a9cc849 (patch)
treeda1d8467e0c8a0a20e838b7e067ba1be7d896640 /t/t3901-i18n-patch.sh
parente6821d09e4655af94f9c8af07333ae710094996a (diff)
downloadgit-c6587bddc4e8a3ee2eef98a0a5cf15542a9cc849.tar.gz
t: simplify loop exit-code status variables
Since shell loops may drop the exit code of failed commands inside the loop, some tests try to keep track of the status by setting a variable. This can end up cumbersome and hard to read; it is much simpler to just exit directly from the loop using "return 1" (since each case is either in a helper function or inside a test snippet). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3901-i18n-patch.sh')
-rwxr-xr-xt/t3901-i18n-patch.sh8
1 files changed, 2 insertions, 6 deletions
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index a392f3d1d6..75cf3ff9bd 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -9,7 +9,7 @@ test_description='i18n settings and format-patch | am pipe'
check_encoding () {
# Make sure characters are not corrupted
- cnt="$1" header="$2" i=1 j=0 bad=0
+ cnt="$1" header="$2" i=1 j=0
while test "$i" -le $cnt
do
git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |
@@ -20,14 +20,10 @@ check_encoding () {
grep "^encoding ISO8859-1" ;;
*)
grep "^encoding ISO8859-1"; test "$?" != 0 ;;
- esac || {
- bad=1
- break
- }
+ esac || return 1
j=$i
i=$(($i+1))
done
- (exit $bad)
}
test_expect_success setup '