aboutsummaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-10-03 14:00:14 -0600
committerJunio C Hamano <gitster@pobox.com>2010-10-06 13:26:33 -0700
commit00648ba0505bbe1999bb6ae2f1d02a0ef923b191 (patch)
treea6bd5229da9fd44b8f29be12cb900d3ef8500868 /t/test-lib.sh
parentbc0f35ca238ff88829cd9839641a316e859348a2 (diff)
downloadgit-00648ba0505bbe1999bb6ae2f1d02a0ef923b191.tar.gz
git-00648ba0505bbe1999bb6ae2f1d02a0ef923b191.tar.xz
Introduce sane_unset and use it to ensure proper && chaining
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index d86edcd7a..87308f5a9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -268,6 +268,17 @@ remove_cr () {
tr '\015' Q | sed -e 's/Q$//'
}
+# In some bourne shell implementations, the "unset" builtin returns
+# nonzero status when a variable to be unset was not set in the first
+# place.
+#
+# Use sane_unset when that should not be considered an error.
+
+sane_unset () {
+ unset "$@"
+ return 0
+}
+
test_tick () {
if test -z "${test_tick+set}"
then