Commit Diff


commit - fbbb53b90ee30e5fde6281e4b06b3fc1d689e083
commit + 49c543a6fe888394ca86e6399c706a9965486134
blob - e59e019d01dee6cf8c0d851c8d4b5ed6beb5c176
blob + 3b683b736207663881b76ad7dc8fe66657258335
--- regress/cmdline/add.sh
+++ regress/cmdline/add.sh
@@ -20,8 +20,8 @@ test_add_basic() {
 	local testroot=`test_init add_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -32,8 +32,8 @@ test_add_basic() {
 	(cd $testroot/wt && got add foo > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -43,8 +43,8 @@ test_double_add() {
 	local testroot=`test_init double_add`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -53,8 +53,8 @@ test_double_add() {
 	(cd $testroot/wt && got add foo > /dev/null)
 
 	(cd $testroot/wt && got add foo > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got add failed unexpectedly" >&2
 		test_done "$testroot" 1
 		return 1
@@ -62,8 +62,8 @@ test_double_add() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -73,8 +73,8 @@ test_add_multiple() {
 	local testroot=`test_init multiple_add`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -83,8 +83,8 @@ test_add_multiple() {
 	echo "new file" > $testroot/wt/bar
 	echo "new file" > $testroot/wt/baz
 	(cd $testroot/wt && got add foo bar baz > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got add failed unexpectedly" >&2
 		test_done "$testroot" 1
 		return 1
@@ -95,8 +95,8 @@ test_add_multiple() {
 	echo "A  foo" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -106,8 +106,8 @@ test_add_file_in_new_subdir() {
 	local testroot=`test_init add_file_in_new_subdir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -119,8 +119,8 @@ test_add_file_in_new_subdir() {
 	(cd $testroot/wt && got add new/foo > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -130,8 +130,8 @@ test_add_deleted() {
 	local testroot=`test_init add_deleted`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -140,8 +140,8 @@ test_add_deleted() {
 
 	echo -n > $testroot/stdout.expected
 	(cd $testroot/wt && got add beta > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got add command succeeded unexpectedly" >&2
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "1"
@@ -150,8 +150,8 @@ test_add_deleted() {
 
 	echo "got: beta: file has unexpected status" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -161,31 +161,31 @@ test_add_directory() {
 	local testroot=`test_init add_directory`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got add . > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
+	ret=$?
 	echo "got: adding directories requires -R option" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got add -I . > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
+	ret=$?
 	echo "got: adding directories requires -R option" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -193,8 +193,8 @@ test_add_directory() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -216,8 +216,8 @@ test_add_directory() {
 	echo 'A  epsilon/zeta2' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -228,8 +228,8 @@ test_add_directory() {
 	echo 'A  tree1/foo' > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -240,8 +240,8 @@ test_add_directory() {
 	echo -n '' > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -252,8 +252,8 @@ test_add_directory() {
 	echo 'A  tree2/foo' > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -278,8 +278,8 @@ test_add_clashes_with_submodule() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "A  repo2" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -291,8 +291,8 @@ test_add_clashes_with_submodule() {
 	# This currently fails with "work tree must be updated"...
 	(cd $testroot/wt && got commit -m 'add file repo2' \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "commit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -301,8 +301,8 @@ test_add_clashes_with_submodule() {
 	echo -n "got: work tree must be updated " > $testroot/stderr.expected
 	echo "before these changes can be committed" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -312,8 +312,8 @@ test_add_symlink() {
 	local testroot=`test_init add_symlink`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -326,8 +326,8 @@ test_add_symlink() {
 
 	echo "A  alpha.link" > $testroot/stdout.expected
 	(cd $testroot/wt && got add alpha.link > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -336,8 +336,8 @@ test_add_symlink() {
 	echo "A  epsilon.link" > $testroot/stdout.expected
 	(cd $testroot/wt && got add epsilon.link > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -346,8 +346,8 @@ test_add_symlink() {
 	echo "A  passwd.link" > $testroot/stdout.expected
 	(cd $testroot/wt && got add passwd.link > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -356,8 +356,8 @@ test_add_symlink() {
 	echo "A  epsilon/beta.link" > $testroot/stdout.expected
 	(cd $testroot/wt && got add epsilon/beta.link > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -366,8 +366,8 @@ test_add_symlink() {
 	echo "A  nonexistent.link" > $testroot/stdout.expected
 	(cd $testroot/wt && got add nonexistent.link > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 548dac7cec6a0bef830836a1220db040da604b7e
blob + 71210cda27e4286934db7aa6882ed109ca1ad397
--- regress/cmdline/backout.sh
+++ regress/cmdline/backout.sh
@@ -20,8 +20,8 @@ test_backout_basic() {
 	local testroot=`test_init backout_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -49,8 +49,8 @@ test_backout_basic() {
 	echo "D  new" >> $testroot/stdout.expected
 	echo "Backed out commit $bad_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -59,8 +59,8 @@ test_backout_basic() {
 	echo "alpha" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -83,8 +83,8 @@ test_backout_basic() {
 	echo 'D  new' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -94,8 +94,8 @@ test_backout_edits_for_file_since_deleted() {
 	local testroot=`test_init backout_edits_for_file_since_deleted`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -121,8 +121,8 @@ test_backout_edits_for_file_since_deleted() {
 		>> $testroot/stdout.expected
 	echo "in the work tree: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -137,8 +137,8 @@ test_backout_edits_for_file_since_deleted() {
 	echo -n '' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -149,8 +149,8 @@ test_backout_next_commit() {
 	local commit0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -175,8 +175,8 @@ test_backout_next_commit() {
 		>> $testroot/stdout.expected
 	echo "in the work tree: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -191,8 +191,8 @@ test_backout_next_commit() {
 	echo "zeta" > $testroot/content.expected
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -201,8 +201,8 @@ test_backout_next_commit() {
 	echo -n '' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - a9916124c369cb2ba1bac4634cd2e80573716a5a
blob + e88c01aa511a2049c9fece87f2e78bb8e9f274b7
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
@@ -28,8 +28,8 @@ blame_cmp() {
 		> $testroot/${file}.blame.git)
 
 	cmp -s $testroot/${file}.blame.git $testroot/${file}.blame.got
-	ret="$?"
-	if [ "$ret" != "0" -a "$xfail" = "" ]; then
+	ret=$?
+	if [ $ret -ne 0 -a "$xfail" = "" ]; then
 		diff -u $testroot/${file}.blame.git $testroot/${file}.blame.got
 		return 1
 	fi
@@ -40,8 +40,8 @@ test_blame_basic() {
 	local testroot=`test_init blame_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -71,15 +71,15 @@ test_blame_basic() {
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -88,8 +88,8 @@ test_blame_tag() {
 	local tag=1.0.0
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -118,15 +118,15 @@ test_blame_tag() {
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -134,8 +134,8 @@ test_blame_file_single_line() {
 	local testroot=`test_init blame_file_single_line`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -153,15 +153,15 @@ test_blame_file_single_line() {
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -169,8 +169,8 @@ test_blame_file_single_line_no_newline() {
 	local testroot=`test_init blame_file_single_line_no_newline`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -188,8 +188,8 @@ test_blame_file_single_line_no_newline() {
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -199,8 +199,8 @@ test_blame_all_lines_replaced() {
 	local testroot=`test_init blame_all_lines_replaced`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -224,8 +224,8 @@ test_blame_all_lines_replaced() {
 	echo "8) $short_commit1 $d $GOT_AUTHOR_8 8" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -236,8 +236,8 @@ test_blame_lines_shifted_up() {
 	local testroot=`test_init blame_lines_shifted_up`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -276,15 +276,15 @@ test_blame_lines_shifted_up() {
 	echo "8) $short_commit1 $d $GOT_AUTHOR_8 8" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -292,8 +292,8 @@ test_blame_lines_shifted_down() {
 	local testroot=`test_init blame_lines_shifted_down`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -346,15 +346,15 @@ test_blame_lines_shifted_down() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -362,8 +362,8 @@ test_blame_commit_subsumed() {
 	local testroot=`test_init blame_commit_subsumed`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -525,15 +525,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -541,8 +541,8 @@ test_blame_blame_h() {
 	local testroot=`test_init blame_blame_h`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -677,7 +677,7 @@ EOF
 	(cd $testroot/wt && got commit -m "change 5" > /dev/null)
 
 	blame_cmp "$testroot" "got_blame.h"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -685,15 +685,15 @@ test_blame_added_on_branch() {
 	local testroot=`test_init blame_added_on_branch`
 
 	got branch -r $testroot/repo -c master newbranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -724,8 +724,8 @@ test_blame_added_on_branch() {
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -744,8 +744,8 @@ test_blame_submodule() {
 	# Attempt a (nonsensical) blame of a submodule.
 	got blame -r $testroot/repo repo2 \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "blame command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -755,8 +755,8 @@ test_blame_submodule() {
 	echo "got: object $submodule_id not found" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -781,8 +781,8 @@ test_blame_symlink() {
 
 	# got blame dereferences symlink to a regular file
 	got blame -r $testroot/repo alpha.link > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "blame command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -793,8 +793,8 @@ test_blame_symlink() {
 		> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" -a "$xfail" = "" ]; then
+	ret=$?
+	if [ $ret -ne 0 -a "$xfail" = "" ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "1"
 		return 1
@@ -802,8 +802,8 @@ test_blame_symlink() {
 
 	# got blame dereferences symlink with relative path
 	got blame -r $testroot/repo epsilon/beta.link > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "blame command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -814,8 +814,8 @@ test_blame_symlink() {
 		> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" -a "$xfail" = "" ]; then
+	ret=$?
+	if [ $ret -ne 0 -a "$xfail" = "" ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "1"
 		return 1
@@ -823,8 +823,8 @@ test_blame_symlink() {
 
 	got blame -r $testroot/repo epsilon.link > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "blame command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -833,8 +833,8 @@ test_blame_symlink() {
 	# blame dereferences symlink to a directory
 	echo "got: /epsilon: wrong type of object" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
 		return 1
@@ -843,8 +843,8 @@ test_blame_symlink() {
 	# got blame fails if symlink target does not exist in repo
 	got blame -r $testroot/repo passwd.link > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "blame command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -853,8 +853,8 @@ test_blame_symlink() {
 	echo "got: /etc/passwd: no such entry found in tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
 		return 1
@@ -862,8 +862,8 @@ test_blame_symlink() {
 
 	got blame -r $testroot/repo nonexistent.link > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "blame command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -872,8 +872,8 @@ test_blame_symlink() {
 	echo "got: /nonexistent: no such entry found in tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
 		return 1
@@ -886,8 +886,8 @@ test_blame_lines_shifted_skip() {
 	local testroot=`test_init blame_lines_shifted_skip`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -968,15 +968,15 @@ EOF
 	echo "7) $short_commit2 $d $GOT_AUTHOR_8 Q" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	blame_cmp "$testroot" "alpha"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
blob - f49f14f4cb25858d75221abe2eef12ed8b318ae2
blob + 8e459f575af5f369a7a0987fa5f5eb2e1680b947
--- regress/cmdline/branch.sh
+++ regress/cmdline/branch.sh
@@ -22,8 +22,8 @@ test_branch_create() {
 
 	# Create a branch based on repository's HEAD reference
 	got branch -r $testroot/repo newbranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got branch command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -31,8 +31,8 @@ test_branch_create() {
 
 	# Ensure that Git recognizes the branch Got has created
 	(cd $testroot/repo && git checkout -q newbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -41,8 +41,8 @@ test_branch_create() {
 	git_commit $testroot/repo -m "committing to delta on newbranch"
 
 	got checkout -b newbranch $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -51,8 +51,8 @@ test_branch_create() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -60,15 +60,15 @@ test_branch_create() {
 
 	# Create a branch based on the work tree's branch
 	(cd $testroot/wt && got branch -n refs/heads/anotherbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q anotherbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -76,15 +76,15 @@ test_branch_create() {
 
 	# Create a branch based on another specific branch
 	(cd $testroot/wt && got branch -n -c master yetanotherbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q yetanotherbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -93,16 +93,16 @@ test_branch_create() {
 	# Create a branch based on a specific commit
 	local commit_id=`git_show_head $testroot/repo`
 	got branch -r $testroot/repo -c $commit_id commitbranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got branch command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q commitbranch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -120,8 +120,8 @@ test_branch_create() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -133,8 +133,8 @@ test_branch_list() {
 
 	for b in branch1 branch2 branch3; do
 		got branch -r $testroot/repo $b
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got branch command failed unexpectedly"
 			test_done "$testroot" "$ret"
 			return 1
@@ -147,16 +147,16 @@ test_branch_list() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "  master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -168,8 +168,8 @@ test_branch_list() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "* master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -185,16 +185,16 @@ test_branch_list() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "~ master: $commit_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -206,16 +206,16 @@ test_branch_list() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "* master: $commit_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update -b branch1 > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -227,8 +227,8 @@ test_branch_list() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "  master: $commit_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -240,8 +240,8 @@ test_branch_delete() {
 
 	for b in branch1 branch2 branch3; do
 		got branch -r $testroot/repo $b
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got branch command failed unexpectedly"
 			test_done "$testroot" "$ret"
 			return 1
@@ -249,8 +249,8 @@ test_branch_delete() {
 	done
 
 	got branch -d branch2 -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got branch command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -261,8 +261,8 @@ test_branch_delete() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "  master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -274,8 +274,8 @@ test_branch_delete() {
 	echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -283,8 +283,8 @@ test_branch_delete() {
 
 	got branch -d bogus_branch_name -r $testroot/repo \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got branch succeeded unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -293,8 +293,8 @@ test_branch_delete() {
 	echo "got: reference refs/heads/bogus_branch_name not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -316,16 +316,16 @@ test_branch_delete() {
 	echo "refs/remotes/origin/master: $commit_id" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -d origin/branch1 -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got branch command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -333,8 +333,8 @@ test_branch_delete() {
 
 	got branch -d refs/remotes/origin/branch3 -r $testroot/repo \
 		> $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got branch command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -348,8 +348,8 @@ test_branch_delete() {
 	echo "refs/remotes/origin/master: $commit_id" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -360,8 +360,8 @@ test_branch_delete_current_branch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -373,8 +373,8 @@ test_branch_delete_current_branch() {
 	echo "got: will not delete this work tree's current branch" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -386,8 +386,8 @@ test_branch_delete_packed() {
 
 	for b in branch1 branch2 branch3; do
 		got branch -r $testroot/repo $b
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got branch command failed unexpectedly"
 			test_done "$testroot" "$ret"
 			return 1
@@ -397,8 +397,8 @@ test_branch_delete_packed() {
 	(cd $testroot/repo && git pack-refs --all)
 
 	got branch -d refs/heads/branch2 -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -409,8 +409,8 @@ test_branch_delete_packed() {
 	echo "  branch3: $commit_id" >> $testroot/stdout.expected
 	echo "  master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -422,8 +422,8 @@ test_branch_delete_packed() {
 	echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -431,8 +431,8 @@ test_branch_delete_packed() {
 
 	got branch -d bogus_branch_name -r $testroot/repo \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got update succeeded unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -441,8 +441,8 @@ test_branch_delete_packed() {
 	echo "got: reference refs/heads/bogus_branch_name not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -454,8 +454,8 @@ test_branch_show() {
 
 	for b in branch1 branch2 branch3; do
 		got branch -r $testroot/repo $b
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got branch command failed unexpectedly"
 			test_done "$testroot" "$ret"
 			return 1
@@ -463,8 +463,8 @@ test_branch_show() {
 	done
 
 	got checkout $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -473,16 +473,16 @@ test_branch_show() {
 	(cd $testroot/wt && got branch > $testroot/stdout)
 	echo "master" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update -b branch1 > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -491,8 +491,8 @@ test_branch_show() {
 	(cd $testroot/wt && got branch > $testroot/stdout)
 	echo "branch1" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 332aac7daf0b874612728683bc951e0b30605f86
blob + f73f4a345848c012f6f17f10fba4accf493f8ae0
--- regress/cmdline/cat.sh
+++ regress/cmdline/cat.sh
@@ -29,8 +29,8 @@ test_cat_basic() {
 	echo "alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo $alpha_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -40,8 +40,8 @@ test_cat_basic() {
 	echo "$delta_id 0100644 delta" > $testroot/stdout.expected
 	got cat -r $testroot/repo $gamma_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -60,8 +60,8 @@ test_cat_basic() {
 
 	got cat -r $testroot/repo $commit_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -85,8 +85,8 @@ test_cat_path() {
 	echo "alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo alpha > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -96,8 +96,8 @@ test_cat_path() {
 	echo "$delta_id 0100644 delta" > $testroot/stdout.expected
 	got cat -r $testroot/repo gamma > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -114,8 +114,8 @@ test_cat_path() {
 	echo "alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo -c $commit_id alpha > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -123,8 +123,8 @@ test_cat_path() {
 	echo "modified alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo -c $commit_id2 alpha > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -153,8 +153,8 @@ test_cat_path() {
 	for arg in master $commit_id3; do
 		got cat -r $testroot/repo $arg > $testroot/stdout
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -172,8 +172,8 @@ test_cat_path() {
 
 	got cat -r $testroot/repo $commit_id2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -183,8 +183,8 @@ test_cat_path() {
 	echo "new file called master" > $testroot/stdout.expected
 	got cat -r $testroot/repo -P master > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -194,8 +194,8 @@ test_cat_path() {
 	echo "new file called $commit_id2" > $testroot/stdout.expected
 	got cat -r $testroot/repo -P $commit_id2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -213,8 +213,8 @@ test_cat_submodule() {
 
 	got cat -r $testroot/repo repo2 > $testroot/stdout \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "cat command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -224,8 +224,8 @@ test_cat_submodule() {
 	echo "got: object $submodule_id not found" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -253,8 +253,8 @@ test_cat_submodule_of_same_repo() {
 
 	got cat -r $testroot/repo repo2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 
@@ -284,8 +284,8 @@ test_cat_symlink() {
 	echo -n "alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo $alpha_link_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -295,8 +295,8 @@ test_cat_symlink() {
 	echo -n "../beta" > $testroot/stdout.expected
 	got cat -r $testroot/repo $epsilon_beta_link_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -306,8 +306,8 @@ test_cat_symlink() {
 	echo -n "epsilon" > $testroot/stdout.expected
 	got cat -r $testroot/repo $epsilon_link_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -317,8 +317,8 @@ test_cat_symlink() {
 	echo -n "/etc/passwd" > $testroot/stdout.expected
 	got cat -r $testroot/repo $passwd_link_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -327,8 +327,8 @@ test_cat_symlink() {
 	echo -n "nonexistent" > $testroot/stdout.expected
 	got cat -r $testroot/repo $nonexistent_link_id > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
blob - 14a25416da706b0bced0477529b71a35b28914d1
blob + d5f017d307e68809b88a4ef9d579902a290129ef
--- regress/cmdline/checkout.sh
+++ regress/cmdline/checkout.sh
@@ -29,15 +29,15 @@ test_checkout_basic() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -51,8 +51,8 @@ test_checkout_basic() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -73,15 +73,15 @@ test_checkout_dir_exists() {
 	mkdir $testroot/wt
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -95,8 +95,8 @@ test_checkout_dir_exists() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -119,8 +119,8 @@ test_checkout_dir_not_empty() {
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "checkout succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -129,8 +129,8 @@ test_checkout_dir_not_empty() {
 	echo "got: $testroot/wt: directory exists and is not empty" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -138,8 +138,8 @@ test_checkout_dir_not_empty() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -161,23 +161,23 @@ test_checkout_sets_xbit() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rwx'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is not executable" >&2
 		ls -l $testroot/wt/xfile >&2
 	fi
@@ -194,16 +194,16 @@ test_checkout_commit_from_wrong_branch() {
 	local head_rev=`git_show_head $testroot/repo`
 	got checkout -b master -c $head_rev $testroot/repo $testroot/wt \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	echo -n "" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -218,8 +218,8 @@ test_checkout_commit_from_wrong_branch() {
 	echo "'got branch -c $head_rev BRANCH_NAME'" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -244,15 +244,15 @@ test_checkout_tag() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout -c $tag $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -266,8 +266,8 @@ test_checkout_tag() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -292,15 +292,15 @@ test_checkout_ignores_submodules() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -314,8 +314,8 @@ test_checkout_ignores_submodules() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -338,15 +338,15 @@ test_checkout_read_only() {
 
 	got checkout $testroot/repo $testroot/wt \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -362,8 +362,8 @@ test_checkout_read_only() {
 	echo "writable and running 'got update' will prevent this" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -377,8 +377,8 @@ test_checkout_read_only() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	chmod -R u+w $testroot/repo # make repo cleanup work
@@ -394,8 +394,8 @@ test_checkout_into_nonempty_dir() {
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "checkout succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -403,8 +403,8 @@ test_checkout_into_nonempty_dir() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -413,8 +413,8 @@ test_checkout_into_nonempty_dir() {
 	echo "got: $testroot/wt: directory exists and is not empty" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -429,15 +429,15 @@ test_checkout_into_nonempty_dir() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout -E $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -452,15 +452,15 @@ test_checkout_into_nonempty_dir() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout -E $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -474,8 +474,8 @@ test_checkout_into_nonempty_dir() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -492,15 +492,15 @@ test_checkout_into_nonempty_dir() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout -E $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -514,8 +514,8 @@ test_checkout_into_nonempty_dir() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -525,8 +525,8 @@ test_checkout_into_nonempty_dir() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -547,8 +547,8 @@ test_checkout_symlink() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -570,8 +570,8 @@ test_checkout_symlink() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -586,8 +586,8 @@ test_checkout_symlink() {
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -602,8 +602,8 @@ test_checkout_symlink() {
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -620,8 +620,8 @@ test_checkout_symlink() {
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -636,8 +636,8 @@ test_checkout_symlink() {
 	readlink $testroot/wt/passwd2.link > $testroot/stdout
 	echo "passwd.link" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -646,8 +646,8 @@ test_checkout_symlink() {
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -656,8 +656,8 @@ test_checkout_symlink() {
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -674,8 +674,8 @@ test_checkout_symlink() {
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -694,8 +694,8 @@ test_checkout_symlink_relative_wtpath() {
 	git_commit $testroot/repo -m "add symlinks"
 
 	(cd $testroot && got checkout $testroot/repo wt > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -709,8 +709,8 @@ test_checkout_symlink_relative_wtpath() {
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -725,8 +725,8 @@ test_checkout_symlink_relative_wtpath() {
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -743,8 +743,8 @@ test_checkout_symlink_relative_wtpath() {
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -753,8 +753,8 @@ test_checkout_symlink_relative_wtpath() {
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -763,8 +763,8 @@ test_checkout_symlink_relative_wtpath() {
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -781,8 +781,8 @@ test_checkout_symlink_relative_wtpath() {
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -801,16 +801,16 @@ test_checkout_repo_with_unknown_extension() {
 	got checkout $testroot/repo $testroot/wt \
 		> $testroot/stdout 2> $testroot/stderr
 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got checkout command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -824,15 +824,15 @@ test_checkout_quiet() {
 	printf "\nNow shut up and hack\n" >> $testroot/stdout.expected
 
 	got checkout -q $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -846,8 +846,8 @@ test_checkout_quiet() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
blob - ca1e787e193580d85479d0f3a60497b0559d95a8
blob + 15c8d5decf9f20816bd1d23ebed6d2d56437e4f1
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
@@ -20,8 +20,8 @@ test_cherrypick_basic() {
 	local testroot=`test_init cherrypick_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -50,8 +50,8 @@ test_cherrypick_basic() {
 	echo "Merged commit $branch_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -60,8 +60,8 @@ test_cherrypick_basic() {
 	echo "modified alpha on branch" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -76,8 +76,8 @@ test_cherrypick_basic() {
 	echo "new file on branch" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -90,8 +90,8 @@ test_cherrypick_basic() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -103,8 +103,8 @@ test_cherrypick_basic() {
 	echo "Merged commit $branch_rev2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -117,8 +117,8 @@ test_cherrypick_basic() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -128,8 +128,8 @@ test_cherrypick_root_commit() {
 	local testroot=`test_init cherrypick_root_commit`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -156,8 +156,8 @@ test_cherrypick_root_commit() {
 	echo "Merged commit $root_commit" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -167,8 +167,8 @@ test_cherrypick_root_commit() {
 	echo "modified new file on branch" >> $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -179,8 +179,8 @@ test_cherrypick_root_commit() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -190,8 +190,8 @@ test_cherrypick_into_work_tree_with_conflicts() {
 	local testroot=`test_init cherrypick_into_work_tree_with_conflicts`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -219,8 +219,8 @@ test_cherrypick_into_work_tree_with_conflicts() {
 	echo "C  alpha" > $testroot/stdout.expected
 	(cd $testroot/wt && got status  > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -228,8 +228,8 @@ test_cherrypick_into_work_tree_with_conflicts() {
 
 	(cd $testroot/wt && got cherrypick $branch_rev \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "cherrypick succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -242,24 +242,24 @@ test_cherrypick_into_work_tree_with_conflicts() {
 		>> $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/content.expected $testroot/wt/alpha
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/wt/alpha
 	fi
 	test_done "$testroot" "$ret"
@@ -274,8 +274,8 @@ test_cherrypick_into_work_tree_with_mixed_commits() {
 	local second_rev=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -295,8 +295,8 @@ test_cherrypick_into_work_tree_with_mixed_commits() {
 
 	(cd $testroot/wt && got cherrypick $branch_rev \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "cherrypick succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -309,16 +309,16 @@ test_cherrypick_into_work_tree_with_mixed_commits() {
 		>> $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -351,8 +351,8 @@ test_cherrypick_modified_submodule() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -376,8 +376,8 @@ test_cherrypick_added_submodule() {
 	echo "A  .gitmodules" > $testroot/stdout.expected
 	echo "Merged commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -392,8 +392,8 @@ test_cherrypick_conflict_wt_file_vs_repo_submodule() {
 	echo "This is a file called repo2" > $testroot/wt/repo2
 	(cd $testroot/wt && got add repo2 > /dev/null)
 	(cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -417,8 +417,8 @@ test_cherrypick_conflict_wt_file_vs_repo_submodule() {
 	echo "A  .gitmodules" > $testroot/stdout.expected
 	echo "Merged commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -429,8 +429,8 @@ test_cherrypick_conflict_wt_file_vs_repo_submodule() {
 	echo "A  .gitmodules" > $testroot/stdout.expected
 	echo "M  repo2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -464,8 +464,8 @@ nonexistent.link@ -> nonexistent
 passwd.link@ -> /etc/passwd
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -495,8 +495,8 @@ EOF
 	echo "A  zeta.link" >> $testroot/stdout.expected
 	echo "Merged commit $commit_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -511,8 +511,8 @@ EOF
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -527,8 +527,8 @@ EOF
 	readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
 	echo ".got/foo" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -543,8 +543,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -561,8 +561,8 @@ EOF
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -571,8 +571,8 @@ EOF
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -587,8 +587,8 @@ EOF
 
 	(cd $testroot/wt && got commit -m 'commit cherrypick result' \
 		> /dev/null 2>$testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got commit succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -598,8 +598,8 @@ EOF
 	echo "outside of paths under version control" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -607,8 +607,8 @@ EOF
 
 	(cd $testroot/wt && got commit -S -m 'commit cherrypick result' \
 		> /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -632,8 +632,8 @@ passwd.link@ -> /etc/passwd
 zeta.link@ -> epsilon/zeta
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -715,8 +715,8 @@ test_cherrypick_symlink_conflicts() {
 		>> $testroot/stdout.expected
 	echo "the work tree: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -741,8 +741,8 @@ test_cherrypick_symlink_conflicts() {
 
 	cp $testroot/wt/alpha.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -757,8 +757,8 @@ test_cherrypick_symlink_conflicts() {
 	echo "this is unversioned file boo" > $testroot/content.expected
 	cp $testroot/wt/boo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -783,8 +783,8 @@ test_cherrypick_symlink_conflicts() {
 
 	cp $testroot/wt/epsilon.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -801,8 +801,8 @@ test_cherrypick_symlink_conflicts() {
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -827,8 +827,8 @@ test_cherrypick_symlink_conflicts() {
 
 	cp $testroot/wt/epsilon/beta.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -855,8 +855,8 @@ test_cherrypick_symlink_conflicts() {
 	echo '>>>>>>>' >> $testroot/content.expected
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -876,8 +876,8 @@ test_cherrypick_symlink_conflicts() {
 	echo -n "" >> $testroot/content.expected
 	cp $testroot/wt/dotgotbar.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -899,8 +899,8 @@ test_cherrypick_symlink_conflicts() {
 
 	cp $testroot/wt/new.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -910,7 +910,7 @@ test_cherrypick_symlink_conflicts() {
 	echo "M  new.link" >> $testroot/stdout.expected
 	echo "D  nonexistent.link" >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -934,8 +934,8 @@ test_cherrypick_with_path_prefix_and_empty_tree() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout -b bar $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -947,8 +947,8 @@ test_cherrypick_with_path_prefix_and_empty_tree() {
 	(cd $testroot/wt && got commit -m "add file on branch bar" > /dev/null)
 
 	got checkout -b bar -p epsilon $testroot/repo $testroot/wt2 > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -959,8 +959,8 @@ test_cherrypick_with_path_prefix_and_empty_tree() {
 	echo "Merged commit $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -986,8 +986,8 @@ test_cherrypick_conflict_no_eol() {
 	local ccc_commit=`git_show_head $testroot/repo`
 
 	got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -999,8 +999,8 @@ test_cherrypick_conflict_no_eol() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1026,8 +1026,8 @@ test_cherrypick_conflict_no_eol2() {
 	local ccc_commit=`git_show_head $testroot/repo`
 
 	got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1040,8 +1040,8 @@ test_cherrypick_conflict_no_eol2() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1315,8 +1315,8 @@ EOF
 	local base_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1351,8 +1351,8 @@ EOF
 	echo "Merged commit $branch_rev2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1373,8 +1373,8 @@ EOF
 	(cd $testroot/wt && got diff |
 		egrep -v '^(diff|blob|file)' > $testroot/diff)
 	cmp -s $testroot/diff.expected $testroot/diff
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/diff.expected $testroot/diff
 	fi
 
@@ -1385,8 +1385,8 @@ test_cherrypick_same_branch() {
 	local testroot=`test_init cherrypick_same_branch`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1417,8 +1417,8 @@ test_cherrypick_same_branch() {
 	echo "in the work tree: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1428,8 +1428,8 @@ test_cherrypick_dot_on_a_line_by_itself() {
 	local testroot=`test_init cherrypick_dot_on_a_line_by_itself`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1445,8 +1445,8 @@ test_cherrypick_dot_on_a_line_by_itself() {
 	echo "Merged commit $branch_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1455,8 +1455,8 @@ test_cherrypick_dot_on_a_line_by_itself() {
 	printf "modified\n:delta\n.\non\n:branch\n" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -1467,8 +1467,8 @@ test_cherrypick_binary_file() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1503,8 +1503,8 @@ test_cherrypick_binary_file() {
 	echo "Merged commit $commit_id1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1514,8 +1514,8 @@ test_cherrypick_binary_file() {
 	chmod 755 $testroot/content.expected
 	cp $testroot/wt/foo $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1528,8 +1528,8 @@ test_cherrypick_binary_file() {
 	echo "Merged commit $commit_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1539,8 +1539,8 @@ test_cherrypick_binary_file() {
 	chmod 755 $testroot/content.expected
 	cp $testroot/wt/foo $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1554,8 +1554,8 @@ test_cherrypick_binary_file() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1573,8 +1573,8 @@ test_cherrypick_binary_file() {
 	echo '>>>>>>>' >> $testroot/content.expected
 	cp $testroot/wt/foo $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1590,8 +1590,8 @@ test_cherrypick_binary_file() {
 	echo -n '?  ' >> $testroot/stdout.expected
 	(cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1609,8 +1609,8 @@ test_cherrypick_binary_file() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1632,8 +1632,8 @@ test_cherrypick_binary_file() {
 		>> $testroot/content.expected
 	cp $testroot/wt/foo $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1643,8 +1643,8 @@ test_cherrypick_binary_file() {
 	chmod 755 $testroot/content.expected
 	cat $testroot/wt/foo-1-* > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1654,8 +1654,8 @@ test_cherrypick_binary_file() {
 	chmod 755 $testroot/content.expected
 	cat $testroot/wt/foo-2-* > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1674,8 +1674,8 @@ test_cherrypick_binary_file() {
 	echo "Merged commit $commit_id4" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
blob - d950aa95587abfc3c97d43aa360191d8fd9fc808
blob + 06fe38880f4015429de2b40bbdae85ed128d5925
--- regress/cmdline/cleanup.sh
+++ regress/cmdline/cleanup.sh
@@ -34,8 +34,8 @@ test_cleanup_unreferenced_loose_objects() {
 	got branch -r $testroot/repo newbranch >/dev/null
 
 	got checkout -b newbranch $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -75,16 +75,16 @@ test_cleanup_unreferenced_loose_objects() {
 	gotadmin cleanup -a -n -q -r $testroot/repo > $testroot/stdout
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	ls -R $testroot/repo/.git/objects > $testroot/objects-after
 	cmp -s $testroot/objects-before $testroot/objects-after
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/objects-before $testroot/objects-after
 		test_done "$testroot" "$ret"
 		return 1
@@ -92,16 +92,16 @@ test_cleanup_unreferenced_loose_objects() {
 
 	# cleanup should remove loose objects that belonged to the branch
 	gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin cleanup failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -143,15 +143,15 @@ test_cleanup_redundant_loose_objects() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -172,16 +172,16 @@ test_cleanup_redundant_loose_objects() {
 	gotadmin cleanup -a -n -q -r $testroot/repo > $testroot/stdout
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	ls -R $testroot/repo/.git/objects > $testroot/objects-after
 	cmp -s $testroot/objects-before $testroot/objects-after
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/objects-before $testroot/objects-after
 		test_done "$testroot" "$ret"
 		return 1
@@ -197,16 +197,16 @@ test_cleanup_redundant_loose_objects() {
 
 	# cleanup should remove all loose objects
 	gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin cleanup failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -229,7 +229,7 @@ test_cleanup_redundant_loose_objects() {
 			ret=1
 			break
 		done
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
@@ -246,8 +246,8 @@ test_cleanup_precious_objects() {
 	# cleanup should now refuse to purge objects
 	gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "gotadmin cleanup succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -258,8 +258,8 @@ test_cleanup_precious_objects() {
 	echo "this implies that objects must not be deleted" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -270,15 +270,15 @@ test_cleanup_missing_pack_file() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -296,8 +296,8 @@ test_cleanup_missing_pack_file() {
 	# cleanup should now refuse to purge objects
 	gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "gotadmin cleanup succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -310,16 +310,16 @@ test_cleanup_missing_pack_file() {
 	echo "be restored or 'gotadmin cleanup -p' must be run" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	gotadmin cleanup -a -r $testroot/repo -p -n > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin cleanup failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -327,24 +327,24 @@ test_cleanup_missing_pack_file() {
 	packidx_path=$testroot/repo/.git/objects/pack/pack-${packhash}.idx
 	echo "$packidx_path could be removed" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	gotadmin cleanup -a -r $testroot/repo -p > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin cleanup failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo "$packidx_path removed" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -353,8 +353,8 @@ test_cleanup_missing_pack_file() {
 	# cleanup should now attempt to purge objects
 	gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin cleanup failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
blob - 0e24ae3c91470f97788ef2e7a418a85ac613d339
blob + 7a0c9fac946246753a140a7bcc326eb9d7dd52a0
--- regress/cmdline/clone.sh
+++ regress/cmdline/clone.sh
@@ -22,35 +22,35 @@ test_clone_basic() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got log -l0 -p -r $testroot/repo > $testroot/log-repo
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got log command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got log command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/log-repo $testroot/log-repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "log -p output of cloned repository differs" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -60,15 +60,15 @@ test_clone_basic() {
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -82,8 +82,8 @@ test_clone_basic() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -98,8 +98,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -118,8 +118,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -136,8 +136,8 @@ test_clone_list() {
 	got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
 
 	got clone -l $testurl/repo > $testroot/stdout 2>$testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -147,8 +147,8 @@ test_clone_list() {
 	got ref -l -r $testroot/repo >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -166,8 +166,8 @@ test_clone_branch() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -b foo $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -183,8 +183,8 @@ test_clone_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -199,8 +199,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -219,8 +219,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -239,8 +239,8 @@ test_clone_all() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -a $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -260,8 +260,8 @@ test_clone_all() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -276,8 +276,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -296,8 +296,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -316,8 +316,8 @@ test_clone_mirror() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -m $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -332,8 +332,8 @@ test_clone_mirror() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -349,8 +349,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -369,8 +369,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -389,8 +389,8 @@ test_clone_mirror_all() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -m -a $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -405,8 +405,8 @@ test_clone_mirror_all() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -422,8 +422,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -442,8 +442,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -462,8 +462,8 @@ test_clone_reference() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -R hoo $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -482,8 +482,8 @@ test_clone_reference() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -499,8 +499,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -520,8 +520,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -540,8 +540,8 @@ test_clone_branch_and_reference() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -R hoo/boo/zoo -b foo $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -558,8 +558,8 @@ test_clone_branch_and_reference() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -575,8 +575,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -596,8 +596,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -616,8 +616,8 @@ test_clone_reference_mirror() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q -R hoo -m $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -631,8 +631,8 @@ test_clone_reference_mirror() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -649,8 +649,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -670,8 +670,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
@@ -687,8 +687,8 @@ test_clone_multiple_branches() {
 	got branch -r $testroot/repo -c $commit_id bar
 
 	got clone -q -b foo -b bar $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -705,8 +705,8 @@ test_clone_multiple_branches() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -721,8 +721,8 @@ remote "origin" {
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/got.conf.expected \
 			$testroot/repo-clone/got.conf
 		test_done "$testroot" "$ret"
@@ -742,8 +742,8 @@ EOF
 	fetch = refs/tags/*:refs/tags/*
 EOF
 	cmp -s $testroot/repo-clone/config $testroot/config.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/config.expected \
 			$testroot/repo-clone/config
 	fi
blob - d878260cbb0d118bc817382895282a23ad5f98d7
blob + e590a17fa75734f18f299a52ca02118739f13b2b
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
@@ -20,8 +20,8 @@ test_commit_basic() {
 	local testroot=`test_init commit_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -40,8 +40,8 @@ test_commit_basic() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -51,8 +51,8 @@ test_commit_new_subdir() {
 	local testroot=`test_init commit_new_subdir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -72,8 +72,8 @@ test_commit_new_subdir() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -83,8 +83,8 @@ test_commit_subdir() {
 	local testroot=`test_init commit_subdir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -100,8 +100,8 @@ test_commit_subdir() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -111,8 +111,8 @@ test_commit_single_file() {
 	local testroot=`test_init commit_single_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -128,8 +128,8 @@ test_commit_single_file() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -140,8 +140,8 @@ test_commit_out_of_date() {
 	local first_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -159,16 +159,16 @@ test_commit_out_of_date() {
 		"changes can be committed" > $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -181,8 +181,8 @@ test_commit_out_of_date() {
 	echo "modified alpha" > $testroot/wt/alpha
 
 	(cd $testroot/wt && got commit -m 'changed alpha ' > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -192,8 +192,8 @@ test_commit_out_of_date() {
 	echo "M  alpha" > $testroot/stdout.expected
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -203,8 +203,8 @@ test_commit_added_subdirs() {
 	local testroot=`test_init commit_added_subdirs`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -231,8 +231,8 @@ test_commit_added_subdirs() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -242,8 +242,8 @@ test_commit_deleted_subdirs() {
 	local testroot=`test_init commit_deleted_subdirs`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -260,8 +260,8 @@ test_commit_deleted_subdirs() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -273,8 +273,8 @@ test_commit_deleted_subdirs() {
 	echo "beta" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -286,8 +286,8 @@ test_commit_rejects_conflicted_file() {
 	local initial_rev=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -308,8 +308,8 @@ test_commit_rejects_conflicted_file() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -323,15 +323,15 @@ test_commit_rejects_conflicted_file() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -341,8 +341,8 @@ test_commit_single_file_multiple() {
 	local testroot=`test_init commit_single_file_multiple`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -358,8 +358,8 @@ test_commit_single_file_multiple() {
 		echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -373,8 +373,8 @@ test_commit_added_and_modified_in_same_dir() {
 	local testroot=`test_init commit_added_and_modified_in_same_dir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -393,8 +393,8 @@ test_commit_added_and_modified_in_same_dir() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -405,8 +405,8 @@ test_commit_path_prefix() {
 	local commit1=`git_show_head $testroot/repo`
 
 	got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -420,8 +420,8 @@ test_commit_path_prefix() {
 	echo "Created commit $commit2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -442,8 +442,8 @@ test_commit_path_prefix() {
 
 	got diff -r $testroot/repo $commit1 $commit2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -462,8 +462,8 @@ test_commit_path_prefix() {
 	echo "Created commit $commit3" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -491,8 +491,8 @@ test_commit_path_prefix() {
 
 	got diff -r $testroot/repo $commit2 $commit3 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -503,8 +503,8 @@ test_commit_dir_path() {
 	local testroot=`test_init commit_dir_path`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -520,8 +520,8 @@ test_commit_dir_path() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -530,8 +530,8 @@ test_commit_dir_path() {
 	echo "M  alpha" > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -541,8 +541,8 @@ test_commit_selected_paths() {
 	local testroot=`test_init commit_selected_paths`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -556,8 +556,8 @@ test_commit_selected_paths() {
 
 	(cd $testroot/wt && got commit -m 'many paths' nonexistent alpha \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "commit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -565,8 +565,8 @@ test_commit_selected_paths() {
 	echo "got: nonexistent: bad path" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -582,8 +582,8 @@ test_commit_selected_paths() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -596,8 +596,8 @@ test_commit_outside_refs_heads() {
 
 	got checkout -b refs/remotes/origin/master \
 	    $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -606,8 +606,8 @@ test_commit_outside_refs_heads() {
 
 	(cd $testroot/wt && got commit -m 'change alpha' \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "commit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -615,8 +615,8 @@ test_commit_outside_refs_heads() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -627,8 +627,8 @@ test_commit_outside_refs_heads() {
 	echo '"refs/heads/" reference namespace' \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -638,8 +638,8 @@ test_commit_no_email() {
 	local testroot=`test_init commit_no_email`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -654,8 +654,8 @@ test_commit_no_email() {
 	echo "is required for compatibility with Git" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -663,8 +663,8 @@ test_commit_no_email() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -674,8 +674,8 @@ test_commit_tree_entry_sorting() {
 	local testroot=`test_init commit_tree_entry_sorting`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -695,7 +695,7 @@ test_commit_tree_entry_sorting() {
 	# Let git-fsck verify the newly written tree to make sure Git is happy
 	(cd $testroot/repo && git fsck --strict  \
 		> $testroot/fsck.stdout 2> $testroot/fsck.stderr)
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -703,8 +703,8 @@ test_commit_gotconfig_author() {
 	local testroot=`test_init commit_gotconfig_author`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -713,15 +713,15 @@ test_commit_gotconfig_author() {
 
 	echo "modified alpha" > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -729,8 +729,8 @@ test_commit_gotconfig_author() {
 	echo "from: Flan Luck <flan_luck@openbsd.org>" \
 		> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -740,8 +740,8 @@ test_commit_gotconfig_worktree_author() {
 	local testroot=`test_init commit_gotconfig_worktree_author`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -752,15 +752,15 @@ test_commit_gotconfig_worktree_author() {
 
 	echo "modified alpha" > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -768,8 +768,8 @@ test_commit_gotconfig_worktree_author() {
 	echo "from: Flan Squee <flan_squee@openbsd.org>" \
 		> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -779,8 +779,8 @@ test_commit_gitconfig_author() {
 	local testroot=`test_init commit_gitconfig_author`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -790,15 +790,15 @@ test_commit_gitconfig_author() {
 
 	echo "modified alpha" > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m 'test gitconfig author' > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -806,8 +806,8 @@ test_commit_gitconfig_author() {
 	echo "from: Flan Luck <flan_luck@openbsd.org>" \
 		> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -817,8 +817,8 @@ test_commit_xbit_change() {
 	local testroot=`test_init commit_xbit_change`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -829,16 +829,16 @@ test_commit_xbit_change() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got commit -mx > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -848,8 +848,8 @@ test_commit_xbit_change() {
 	echo 'm  alpha' > $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -859,8 +859,8 @@ test_commit_xbit_change() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -872,16 +872,16 @@ test_commit_xbit_change() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got commit -mx > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -891,8 +891,8 @@ test_commit_xbit_change() {
 	echo 'm  alpha' > $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -904,8 +904,8 @@ test_commit_xbit_change() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -920,8 +920,8 @@ commit_check_mode() {
 	chmod $mode $testroot/wt/alpha
 
 	(cd $testroot/wt && got commit -mm > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -931,8 +931,8 @@ commit_check_mode() {
 	echo 'M  alpha' > $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -945,8 +945,8 @@ commit_check_mode() {
 	echo "$alpha_id $expected_mode alpha" > $testroot/stdout.expected
 	got cat -r $testroot/repo $tree_id | grep 'alpha$' > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	return $ret
@@ -956,8 +956,8 @@ test_commit_normalizes_filemodes() {
 	local testroot=`test_init commit_normalizes_filemodes`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -965,24 +965,24 @@ test_commit_normalizes_filemodes() {
 	modes="600 400 460 640 440 660 444 666"
 	for m in $modes; do
 		commit_check_mode "$m" "0100644"
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			break
 		fi
 	done
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	modes="700 500 570 750 550 770 555 777"
 	for m in $modes; do
 		commit_check_mode "$m" "0100755"
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			break
 		fi
 	done
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -998,8 +998,8 @@ test_commit_with_unrelated_submodule() {
 	(cd $testroot/repo && git commit -q -m 'adding submodule')
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1010,8 +1010,8 @@ test_commit_with_unrelated_submodule() {
 	echo "" > $testroot/stdout.expected
 
 	(cd $testroot/wt && got commit -m 'modify alpha' > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1022,8 +1022,8 @@ test_commit_with_unrelated_submodule() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1039,8 +1039,8 @@ check_symlinks() {
 	readlink $wtpath/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1053,8 +1053,8 @@ check_symlinks() {
 	readlink $wtpath/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1067,15 +1067,15 @@ check_symlinks() {
 
 	echo -n "/etc/passwd" > $testroot/content.expected
 	cp $wtpath/passwd.link $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "cp command failed unexpectedly" >&2
 		return 1
 	fi
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		return 1
 	fi
@@ -1083,8 +1083,8 @@ check_symlinks() {
 	readlink $wtpath/epsilon/beta.link > $testroot/stdout
 	echo "../beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1092,8 +1092,8 @@ check_symlinks() {
 	readlink $wtpath/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1105,8 +1105,8 @@ test_commit_symlink() {
 	local testroot=`test_init commit_symlink`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1121,8 +1121,8 @@ test_commit_symlink() {
 
 	(cd $testroot/wt && got commit -m 'test commit_symlink' \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got commit succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1131,8 +1131,8 @@ test_commit_symlink() {
 	echo "symbolic link points outside of paths under version control" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1150,8 +1150,8 @@ test_commit_symlink() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1159,14 +1159,14 @@ test_commit_symlink() {
 
 	# verify created in-repository tree
 	got checkout $testroot/repo $testroot/wt2 > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	check_symlinks $testroot/wt2
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1180,8 +1180,8 @@ test_commit_symlink() {
 	# 'got update' should reinstall passwd.link as a regular file
 	(cd $testroot/wt && got update > /dev/null)
 	check_symlinks $testroot/wt
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1199,8 +1199,8 @@ test_commit_symlink() {
 
 	(cd $testroot/wt && got commit -m 'test commit_symlink' \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got commit succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1209,8 +1209,8 @@ test_commit_symlink() {
 	echo "symbolic link points outside of paths under version control" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1229,8 +1229,8 @@ test_commit_symlink() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1252,8 +1252,8 @@ new.link@ -> alpha
 passwd.link@ -> /etc/passwd
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1263,8 +1263,8 @@ test_commit_fix_bad_symlink() {
 	local testroot=`test_init commit_fix_bad_symlink`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1290,8 +1290,8 @@ test_commit_fix_bad_symlink() {
 
 	# create another work tree which will contain the "bad" symlink
 	got checkout $testroot/repo $testroot/wt2 > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1308,8 +1308,8 @@ test_commit_fix_bad_symlink() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1324,16 +1324,16 @@ test_commit_fix_bad_symlink() {
 	readlink $testroot/wt/passwd.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
 
 	# Update the other work tree; the bad symlink should be fixed
 	(cd $testroot/wt2 && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1348,8 +1348,8 @@ test_commit_fix_bad_symlink() {
 	readlink $testroot/wt2/passwd.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1361,8 +1361,8 @@ test_commit_prepared_logmsg() {
 	local testroot=`test_init commit_prepared_logmsg`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1390,8 +1390,8 @@ EOF
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1409,8 +1409,8 @@ EOF
 
 	(cd $testroot/wt && got log -l 1 > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1429,8 +1429,8 @@ EOF
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1450,8 +1450,8 @@ EOF
 
 	(cd $testroot/wt && got log -l 1 > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1461,8 +1461,8 @@ test_commit_large_file() {
 	local testroot=`test_init commit_large_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1478,8 +1478,8 @@ test_commit_large_file() {
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1487,16 +1487,16 @@ test_commit_large_file() {
 
 	new_id=`get_blob_id $testroot/repo "" new`
 	got cat -r $testroot/repo $new_id > $testroot/new
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/new $testroot/wt/new
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/new $testroot/wt/new
 	fi
 	test_done "$testroot" "$ret"
blob - df81db689facacce41e7257238b81e939bc87e2a
blob + 26f717faa35b5906f8abb7c9f459f633ebaa09dc
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -137,8 +137,8 @@ git_fsck()
 
 	(cd $repo && git fsck --strict \
 		> $testroot/fsck.stdout 2> $testroot/fsck.stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo -n "git fsck: "
 		cat $testroot/fsck.stderr
 		echo "git fsck failed; leaving test data in $testroot"
@@ -216,8 +216,8 @@ test_cleanup()
 	local testroot="$1"
 
 	git_fsck $testroot $testroot/repo
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		return $ret
 	fi
 
blob - 20900fc5fd72f1cac044afaa917e0c224220d5f9
blob + 74dae87bde2cac25abaa0af2a1c84df2209884ca
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
@@ -21,8 +21,8 @@ test_diff_basic() {
 	local head_rev=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -59,8 +59,8 @@ test_diff_basic() {
 
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -70,8 +70,8 @@ test_diff_basic() {
 	(cd $testroot/repo && got diff 2> $testroot/stderr)
 	echo "got: no got work tree found" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -82,8 +82,8 @@ test_diff_basic() {
 	(cd $testroot/repo && got diff $head_rev foo 2> $testroot/stderr)
 	echo "got: foo: object not found" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -95,8 +95,8 @@ test_diff_basic() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -105,8 +105,8 @@ test_diff_basic() {
 	echo "got: nonexistent: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -151,8 +151,8 @@ test_diff_basic() {
 
 	(cd $testroot/wt && got diff new alpha epsilon beta > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -161,15 +161,15 @@ test_diff_basic() {
 	# different order of arguments results in same output order
 	(cd $testroot/wt && got diff alpha new epsilon beta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -180,15 +180,15 @@ test_diff_basic() {
 	got br -r $testroot/repo -c master new > /dev/null
 	(cd $testroot/wt && got diff new alpha epsilon beta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -198,8 +198,8 @@ test_diff_basic() {
 	echo master > $testroot/wt/master
 	(cd $testroot/wt && got add master > /dev/null)
 	(cd $testroot/wt && got diff master new > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -207,40 +207,40 @@ test_diff_basic() {
 	echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
 	# diff between the branches is empty
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	# same without a work tree
 	(cd $testroot/repo && got diff master new > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	# same with -r argument
 	got diff -r $testroot/repo master new > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -248,8 +248,8 @@ test_diff_basic() {
 
 	# -P can be used to force use of paths
 	(cd $testroot/wt && got diff -P new master > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -268,8 +268,8 @@ test_diff_basic() {
 	echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
 	echo '+new file' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -277,8 +277,8 @@ test_diff_basic() {
 
 	# -P can only be used in a work tree
 	got diff -r $testroot/repo -P new master 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -286,8 +286,8 @@ test_diff_basic() {
 	echo "got: -P option can only be used when diffing a work tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -302,15 +302,15 @@ test_diff_basic() {
 	echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
 	echo '+new file' >> $testroot/stdout.expected
 	(cd $testroot/wt && got diff new > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "diff failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -319,8 +319,8 @@ test_diff_basic() {
 	# diff with just one object ID argument results in
 	# interpretation of argument as a path
 	(cd $testroot/wt && got diff $head_rev 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -328,8 +328,8 @@ test_diff_basic() {
 	echo "got: $head_rev: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -339,8 +339,8 @@ test_diff_basic() {
 	# interpretation of arguments as paths
 	(cd $testroot/wt && got diff new $head_rev master \
 		> $testroot/stout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -354,8 +354,8 @@ test_diff_basic() {
 	echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
 	echo '+new file' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -364,8 +364,8 @@ test_diff_basic() {
 	echo "got: $head_rev: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		return 1
 	fi
@@ -388,8 +388,8 @@ test_diff_shows_conflict() {
 	local base_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -412,8 +412,8 @@ test_diff_shows_conflict() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -455,8 +455,8 @@ test_diff_shows_conflict() {
 	(cd $testroot/wt && got diff > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -496,8 +496,8 @@ test_diff_tag() {
 
 	got diff -r $testroot/repo $commit_id0 $tag1 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -516,8 +516,8 @@ test_diff_tag() {
 
 	got diff -r $testroot/repo $tag1 $tag2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -557,8 +557,8 @@ test_diff_lightweight_tag() {
 
 	got diff -r $testroot/repo $commit_id0 $tag1 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -577,8 +577,8 @@ test_diff_lightweight_tag() {
 
 	got diff -r $testroot/repo $tag1 $tag2 > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -589,8 +589,8 @@ test_diff_ignore_whitespace() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -606,8 +606,8 @@ test_diff_ignore_whitespace() {
 	echo 'file + alpha' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -629,8 +629,8 @@ test_diff_submodule_of_same_repo() {
 	# Currently fails with "wrong type of object" error
 	got diff -r $testroot/repo $epsilon_id $submodule_id \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -638,8 +638,8 @@ test_diff_submodule_of_same_repo() {
 	echo "got: wrong type of object" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		return 1
 	fi
@@ -660,8 +660,8 @@ test_diff_symlinks_in_work_tree() {
 	local commit_id1=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -743,8 +743,8 @@ test_diff_symlinks_in_work_tree() {
 	echo '\ No newline at end of file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -860,8 +860,8 @@ test_diff_symlinks_in_repo() {
 	echo '\ No newline at end of file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -872,8 +872,8 @@ test_diff_binary_files() {
 	local head_rev=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -889,8 +889,8 @@ test_diff_binary_files() {
 
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -a -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -907,8 +907,8 @@ test_diff_binary_files() {
 
 	(cd $testroot/wt && got diff -a > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -a -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -934,8 +934,8 @@ test_diff_binary_files() {
 
 	(cd $testroot/wt && got diff -a > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -a -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -948,8 +948,8 @@ test_diff_commits() {
 	beta_id0=`get_blob_id $testroot/repo "" beta`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -987,8 +987,8 @@ test_diff_commits() {
 
 	(cd $testroot/wt && got diff -c master > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -998,8 +998,8 @@ test_diff_commits() {
 	(cd $testroot/wt && got diff -c $commit_id0 -c master \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1029,8 +1029,8 @@ test_diff_commits() {
 	(cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1048,8 +1048,8 @@ test_diff_commits() {
 	(cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 alpha \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1058,8 +1058,8 @@ test_diff_commits() {
 	(cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 alpha \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1081,8 +1081,8 @@ test_diff_commits() {
 	(cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 \
 		beta new > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1091,16 +1091,16 @@ test_diff_commits() {
 	# more than two -c options are not allowed
 	(cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 -c foo \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo "got: too many -c options used" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1109,8 +1109,8 @@ test_diff_commits() {
 	# use of -c options implies a repository diff; use with -P is an error
 	(cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -P foo \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1118,8 +1118,8 @@ test_diff_commits() {
 	echo "got: -P option can only be used when diffing a work tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1128,8 +1128,8 @@ test_diff_commits() {
 	# use of -c options implies a repository diff; use with -s is an error
 	(cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -s foo \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1137,8 +1137,8 @@ test_diff_commits() {
 	echo "got: -s option can only be used when diffing a work tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1147,8 +1147,8 @@ test_diff_commits() {
 	# three arguments imply use of path filtering (repository case)
 	(cd $testroot/repo && got diff $commit_id0 $commit_id1 foo \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1156,8 +1156,8 @@ test_diff_commits() {
 	echo "got: specified paths cannot be resolved: no got work tree found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1166,8 +1166,8 @@ test_diff_commits() {
 	# three arguments imply use of path filtering (work tree case)
 	(cd $testroot/wt && got diff $commit_id0 master foo \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "diff succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1175,8 +1175,8 @@ test_diff_commits() {
 	echo "got: $commit_id0: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -1187,7 +1187,7 @@ test_diff_ignored_file() {
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
 	ret=$?
-	if [ $ret != 0 ]; then
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1206,7 +1206,7 @@ test_diff_ignored_file() {
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
-	if [ $ret != 0 ]; then
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 5b536e8cfc092fb0ac4d203d6360716d2f94ff5b
blob + a47da6f0af1aa406f84e1d46e3d290ad42d50012
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
@@ -22,8 +22,8 @@ test_fetch_basic() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -34,7 +34,7 @@ test_fetch_basic() {
 	local commit_id2=`git_show_head $testroot/repo`
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -42,8 +42,8 @@ test_fetch_basic() {
 
 	got fetch -q -r $testroot/repo-clone > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -52,35 +52,35 @@ test_fetch_basic() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got log -l0 -p -r $testroot/repo > $testroot/log-repo
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got log command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got log command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/log-repo $testroot/log-repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "log -p output of cloned repository differs" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -90,15 +90,15 @@ test_fetch_basic() {
 	echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -112,8 +112,8 @@ test_fetch_basic() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -129,8 +129,8 @@ test_fetch_list() {
 	got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -138,8 +138,8 @@ test_fetch_list() {
 
 	(cd $testroot/repo-clone && got fetch -q -l \
 		> $testroot/stdout 2>$testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -148,8 +148,8 @@ test_fetch_list() {
 	got ref -l -r $testroot/repo > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -161,8 +161,8 @@ test_fetch_branch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -184,8 +184,8 @@ test_fetch_branch() {
 	local commit_id3=`git_show_head $testroot/repo`
 
 	got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -194,8 +194,8 @@ test_fetch_branch() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -216,16 +216,16 @@ test_fetch_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -234,8 +234,8 @@ test_fetch_branch() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -255,8 +255,8 @@ test_fetch_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -268,8 +268,8 @@ test_fetch_all() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -292,16 +292,16 @@ test_fetch_all() {
 	# refs/hoo/boo/zoo is missing because it is outside of refs/heads
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -q -a -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -321,8 +321,8 @@ test_fetch_all() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -338,8 +338,8 @@ test_fetch_empty_packfile() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -360,16 +360,16 @@ test_fetch_empty_packfile() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -q -a -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -389,8 +389,8 @@ test_fetch_empty_packfile() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -409,8 +409,8 @@ test_fetch_delete_branch() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -a -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -431,8 +431,8 @@ test_fetch_delete_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -441,8 +441,8 @@ test_fetch_delete_branch() {
 	got branch -r $testroot/repo -d foo >/dev/null
 
 	got fetch -q -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -462,16 +462,16 @@ test_fetch_delete_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -480,8 +480,8 @@ test_fetch_delete_branch() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -501,8 +501,8 @@ test_fetch_delete_branch() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -521,8 +521,8 @@ test_fetch_delete_branch_mirror() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -a -m -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -537,8 +537,8 @@ test_fetch_delete_branch_mirror() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -547,8 +547,8 @@ test_fetch_delete_branch_mirror() {
 	got branch -r $testroot/repo -d foo >/dev/null
 
 	got fetch -q -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -563,16 +563,16 @@ test_fetch_delete_branch_mirror() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -581,8 +581,8 @@ test_fetch_delete_branch_mirror() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -597,8 +597,8 @@ test_fetch_delete_branch_mirror() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -618,8 +618,8 @@ test_fetch_update_tag() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 
 	got clone -a -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -649,16 +649,16 @@ test_fetch_update_tag() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -a -q -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -678,8 +678,8 @@ test_fetch_update_tag() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -687,8 +687,8 @@ test_fetch_update_tag() {
 
 	got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
 		tail -n 1 > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -698,8 +698,8 @@ test_fetch_update_tag() {
 		> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -719,16 +719,16 @@ test_fetch_update_tag() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -737,8 +737,8 @@ test_fetch_update_tag() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -758,8 +758,8 @@ test_fetch_update_tag() {
 	echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -771,8 +771,8 @@ test_fetch_reference() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -796,8 +796,8 @@ test_fetch_reference() {
 
 	got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got fetch command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -806,8 +806,8 @@ test_fetch_reference() {
 	echo -n > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -817,16 +817,16 @@ test_fetch_reference() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got fetch -q -r $testroot/repo-clone -R refs/hoo
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -845,8 +845,8 @@ test_fetch_reference() {
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -859,8 +859,8 @@ test_fetch_replace_symref() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -m -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -876,8 +876,8 @@ test_fetch_replace_symref() {
 	echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -885,8 +885,8 @@ test_fetch_replace_symref() {
 
 	got fetch -r $testroot/repo-clone -R refs/hoo \
 		2> $testroot/stderr | grep ^Replacing > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -896,8 +896,8 @@ test_fetch_replace_symref() {
 		> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -910,8 +910,8 @@ test_fetch_replace_symref() {
 	echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -924,8 +924,8 @@ test_fetch_update_headref() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -941,8 +941,8 @@ test_fetch_update_headref() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -957,8 +957,8 @@ test_fetch_update_headref() {
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -976,8 +976,8 @@ test_fetch_update_headref() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -998,8 +998,8 @@ test_fetch_update_headref() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1011,8 +1011,8 @@ test_fetch_headref_deleted_locally() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1028,8 +1028,8 @@ test_fetch_headref_deleted_locally() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1038,8 +1038,8 @@ test_fetch_headref_deleted_locally() {
 	got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
 
 	got fetch -q -r $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1055,8 +1055,8 @@ test_fetch_headref_deleted_locally() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1072,8 +1072,8 @@ test_fetch_gotconfig_remote_repo() {
 	got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1096,8 +1096,8 @@ EOF
 		> $testroot/stderr.expected
 	(cd $testroot/repo-clone && got fetch -q nonexistent \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got fetch command succeeded unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
@@ -1106,8 +1106,8 @@ EOF
 
 	(cd $testroot/repo-clone && got fetch -q -l foobar \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1116,8 +1116,8 @@ EOF
 	got ref -l -r $testroot/repo > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1133,8 +1133,8 @@ remote "barbaz" {
 }
 EOF
 	(cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1143,8 +1143,8 @@ EOF
 	got ref -l -r $testroot/repo > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1179,8 +1179,8 @@ EOF
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1192,15 +1192,15 @@ test_fetch_delete_remote_refs() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1214,8 +1214,8 @@ test_fetch_delete_remote_refs() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1223,8 +1223,8 @@ test_fetch_delete_remote_refs() {
 
 	got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got fetch command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1232,8 +1232,8 @@ test_fetch_delete_remote_refs() {
 
 	echo "got: -X option requires a remote name" > $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1241,8 +1241,8 @@ test_fetch_delete_remote_refs() {
 
 	got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1254,15 +1254,15 @@ test_fetch_delete_remote_refs() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1272,8 +1272,8 @@ test_fetch_delete_remote_refs() {
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - c944b6d2017466ab5b2bd1f3d69c28fff83eb0b1
blob + b15d00ef680f545b9c19d914b7c9d87cf23b1c8f
--- regress/cmdline/histedit.sh
+++ regress/cmdline/histedit.sh
@@ -39,8 +39,8 @@ test_histedit_no_op() {
 		> $testroot/diff.expected
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -73,8 +73,8 @@ test_histedit_no_op() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -83,8 +83,8 @@ test_histedit_no_op() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -99,8 +99,8 @@ test_histedit_no_op() {
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -110,8 +110,8 @@ test_histedit_no_op() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -122,8 +122,8 @@ test_histedit_no_op() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -133,8 +133,8 @@ test_histedit_no_op() {
 		> $testroot/diff
 	sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
 	cmp -s $testroot/diff.expected $testroot/diff
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/diff.expected $testroot/diff
 		test_done "$testroot" "$ret"
 		return 1
@@ -144,8 +144,8 @@ test_histedit_no_op() {
 
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -191,8 +191,8 @@ history forked at $fork_commit
 EOF
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -205,15 +205,15 @@ EOF
 	echo "$old_commit2" >> $testroot/stdout.expected
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -222,8 +222,8 @@ EOF
 	(cd $testroot/repo && got histedit -l > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -249,8 +249,8 @@ test_histedit_swap() {
 		> $testroot/diff.expected
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -282,8 +282,8 @@ test_histedit_swap() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -292,8 +292,8 @@ test_histedit_swap() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -308,8 +308,8 @@ test_histedit_swap() {
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -319,8 +319,8 @@ test_histedit_swap() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -331,8 +331,8 @@ test_histedit_swap() {
 	echo "commit $new_commit2" >> $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -342,8 +342,8 @@ test_histedit_swap() {
 		> $testroot/diff
 	sed -i -e "s/$old_commit2/$new_commit1/" $testroot/diff.expected
 	cmp -s $testroot/diff.expected $testroot/diff
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/diff.expected $testroot/diff
 	fi
 	test_done "$testroot" "$ret"
@@ -368,8 +368,8 @@ test_histedit_drop() {
 		> $testroot/diff.expected
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -396,8 +396,8 @@ test_histedit_drop() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -407,8 +407,8 @@ test_histedit_drop() {
 		echo "$f" > $testroot/content.expected
 		cat $testroot/wt/$f > $testroot/content
 		cmp -s $testroot/content.expected $testroot/content
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/content.expected $testroot/content
 			test_done "$testroot" "$ret"
 			return 1
@@ -425,8 +425,8 @@ test_histedit_drop() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -436,8 +436,8 @@ test_histedit_drop() {
 	echo "commit $new_commit2 (master)" > $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -448,8 +448,8 @@ test_histedit_drop() {
 	sed -i -e "s/$old_commit1/$orig_commit/" $testroot/diff.expected
 	sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
 	cmp -s $testroot/diff.expected $testroot/diff
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/diff.expected $testroot/diff
 	fi
 	test_done "$testroot" "$ret"
@@ -476,8 +476,8 @@ test_histedit_fold() {
 	local old_commit3=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -515,8 +515,8 @@ test_histedit_fold() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -525,8 +525,8 @@ test_histedit_fold() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -541,8 +541,8 @@ test_histedit_fold() {
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -552,8 +552,8 @@ test_histedit_fold() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -563,8 +563,8 @@ test_histedit_fold() {
 	echo "commit $new_commit2 (master)" > $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -587,8 +587,8 @@ test_histedit_edit() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -609,8 +609,8 @@ test_histedit_edit() {
 	echo "Stopping histedit for amending commit $old_commit1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -622,8 +622,8 @@ test_histedit_edit() {
 	(cd $testroot/wt && got stage alpha > /dev/null)
 	(cd $testroot/wt && got histedit -c > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -633,8 +633,8 @@ test_histedit_edit() {
 	echo "these changes must be committed or unstaged first" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -659,8 +659,8 @@ test_histedit_edit() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -669,8 +669,8 @@ test_histedit_edit() {
 	echo "edited modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -685,8 +685,8 @@ test_histedit_edit() {
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -696,8 +696,8 @@ test_histedit_edit() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -708,8 +708,8 @@ test_histedit_edit() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -732,8 +732,8 @@ test_histedit_fold_last_commit() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -745,8 +745,8 @@ test_histedit_fold_last_commit() {
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -756,8 +756,8 @@ test_histedit_fold_last_commit() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -780,8 +780,8 @@ test_histedit_missing_commit() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -792,8 +792,8 @@ test_histedit_missing_commit() {
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -803,8 +803,8 @@ test_histedit_missing_commit() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -827,8 +827,8 @@ test_histedit_abort() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -852,8 +852,8 @@ test_histedit_abort() {
 	echo "Stopping histedit for amending commit $old_commit1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -875,8 +875,8 @@ test_histedit_abort() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -886,8 +886,8 @@ test_histedit_abort() {
 		echo "$f" > $testroot/content.expected
 		cat $testroot/wt/$f > $testroot/content
 		cmp -s $testroot/content.expected $testroot/content
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/content.expected $testroot/content
 			test_done "$testroot" "$ret"
 			return 1
@@ -897,8 +897,8 @@ test_histedit_abort() {
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -909,8 +909,8 @@ test_histedit_abort() {
 	echo "?  epsilon/new" > $testroot/stdout.expected
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -921,8 +921,8 @@ test_histedit_abort() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -938,8 +938,8 @@ test_histedit_path_prefix_drop() {
 
 	got checkout -c $orig_commit -p gamma $testroot/repo \
 		$testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -949,8 +949,8 @@ test_histedit_path_prefix_drop() {
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -962,8 +962,8 @@ test_histedit_path_prefix_drop() {
 		>> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -972,8 +972,8 @@ test_histedit_path_prefix_drop() {
 	rm -rf $testroot/wt
 	got checkout -c $orig_commit -p epsilon $testroot/repo \
 		$testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -989,8 +989,8 @@ test_histedit_path_prefix_drop() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -999,8 +999,8 @@ test_histedit_path_prefix_drop() {
 	echo "zeta" > $testroot/content.expected
 	cat $testroot/wt/zeta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1011,8 +1011,8 @@ test_histedit_path_prefix_drop() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1021,8 +1021,8 @@ test_histedit_path_prefix_drop() {
 	(cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
 	echo "commit $orig_commit (master)" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1041,8 +1041,8 @@ test_histedit_path_prefix_edit() {
 
 	got checkout -c $orig_commit -p gamma $testroot/repo \
 		$testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1053,8 +1053,8 @@ test_histedit_path_prefix_edit() {
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1066,8 +1066,8 @@ test_histedit_path_prefix_edit() {
 		>> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1076,8 +1076,8 @@ test_histedit_path_prefix_edit() {
 	rm -rf $testroot/wt
 	got checkout -c $orig_commit -p epsilon $testroot/repo \
 		$testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1090,8 +1090,8 @@ test_histedit_path_prefix_edit() {
 	echo "Stopping histedit for amending commit $old_commit1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1100,8 +1100,8 @@ test_histedit_path_prefix_edit() {
 	echo "modified zeta" > $testroot/content.expected
 	cat $testroot/wt/zeta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1111,8 +1111,8 @@ test_histedit_path_prefix_edit() {
 
 	echo "M  zeta"> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1130,8 +1130,8 @@ test_histedit_path_prefix_edit() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1141,8 +1141,8 @@ test_histedit_path_prefix_edit() {
 	echo "commit $new_commit1 (master)" > $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1152,8 +1152,8 @@ test_histedit_path_prefix_edit() {
 		> $testroot/diff
 	sed -i -e "s/$old_commit1/$new_commit1/" $testroot/diff.expected
 	cmp -s $testroot/diff.expected $testroot/diff
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/diff.expected $testroot/diff
 	fi
 	test_done "$testroot" "$ret"
@@ -1164,8 +1164,8 @@ test_histedit_outside_refs_heads() {
 	local commit1=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -1175,8 +1175,8 @@ test_histedit_outside_refs_heads() {
 
 	(cd $testroot/wt && got commit -m 'change alpha' \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1184,16 +1184,16 @@ test_histedit_outside_refs_heads() {
 	local commit2=`git_show_head $testroot/repo`
 
 	got ref -r $testroot/repo -c master refs/remotes/origin/master
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update -b origin/master -c $commit1 >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -1208,8 +1208,8 @@ test_histedit_outside_refs_heads() {
 	echo '"refs/heads/" reference namespace' \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -1232,8 +1232,8 @@ test_histedit_fold_last_commit_swap() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1246,8 +1246,8 @@ test_histedit_fold_last_commit_swap() {
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
 
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "histedit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1273,8 +1273,8 @@ test_histedit_fold_last_commit_swap() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1299,8 +1299,8 @@ test_histedit_split_commit() {
 	local short_old_commit2=`trim_obj_id 28 $old_commit2`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1311,8 +1311,8 @@ test_histedit_split_commit() {
 
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "histedit failed unexpectedly:" >&2
 		cat $testroot/stderr >&2
 		test_done "$testroot" "$ret"
@@ -1326,32 +1326,32 @@ test_histedit_split_commit() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got ci -m "commitA" alpha >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got ci -m "commitB" beta >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got ci -m "commitC" epsilon/new >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1359,8 +1359,8 @@ test_histedit_split_commit() {
 
 	(cd $testroot/wt && got histedit -c \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "histedit failed unexpectedly:" >&2
 		cat $testroot/stderr >&2
 		test_done "$testroot" "$ret"
@@ -1378,8 +1378,8 @@ test_histedit_split_commit() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1403,8 +1403,8 @@ test_histedit_duplicate_commit_in_script() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1416,8 +1416,8 @@ test_histedit_duplicate_commit_in_script() {
 
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "histedit succeeded unexpectedly:" >&2
 		cat $testroot/stdout >&2
 		test_done "$testroot" "$ret"
@@ -1429,8 +1429,8 @@ test_histedit_duplicate_commit_in_script() {
 	echo "in histedit script" >> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -1458,8 +1458,8 @@ test_histedit_fold_add_delete() {
 	local old_commit3=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1492,8 +1492,8 @@ test_histedit_fold_add_delete() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1509,8 +1509,8 @@ test_histedit_fold_add_delete() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1519,8 +1519,8 @@ test_histedit_fold_add_delete() {
 	(cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
 	echo "commit $new_commit1 (master)" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1529,8 +1529,8 @@ test_histedit_fold_add_delete() {
 	got tree -r $testroot/repo epsilon > $testroot/stdout
 	echo "zeta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1557,8 +1557,8 @@ test_histedit_fold_only() {
 	local old_commit3=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1597,8 +1597,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1607,8 +1607,8 @@ EOF
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1623,8 +1623,8 @@ EOF
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1634,8 +1634,8 @@ EOF
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1645,8 +1645,8 @@ EOF
 	echo "commit $new_commit1 (master)" > $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1673,8 +1673,8 @@ test_histedit_fold_only_empty_logmsg() {
 	local old_commit3=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1715,8 +1715,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1725,8 +1725,8 @@ EOF
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1741,8 +1741,8 @@ EOF
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1752,8 +1752,8 @@ EOF
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1763,8 +1763,8 @@ EOF
 	echo "commit $new_commit1 (master)" > $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1787,8 +1787,8 @@ test_histedit_edit_only() {
 	local old_commit2=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1804,8 +1804,8 @@ test_histedit_edit_only() {
 	echo "Stopping histedit for amending commit $old_commit1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1833,8 +1833,8 @@ EOF
 	echo "Stopping histedit for amending commit $old_commit2" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1861,8 +1861,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1871,8 +1871,8 @@ EOF
 	echo "edited modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1887,8 +1887,8 @@ EOF
 	echo "new file on master" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1898,8 +1898,8 @@ EOF
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1910,8 +1910,8 @@ EOF
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $orig_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1934,7 +1934,7 @@ EOF
 
 	(cd $testroot/wt/ && got commit -m 'modified alpha on master' \
 		alpha > /dev/null)
-	ret="$?"
+	ret=$?
 	if [ "$?" != 0 ]; then
 		echo "got commit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
@@ -1945,7 +1945,7 @@ EOF
 	echo "pick $top_commit" > "$testroot/histedit-script"
 
 	(cd $testroot/wt/ && got update -c $orig_commit > /dev/null)
-	ret="$?"
+	ret=$?
 	if [ "$?" != 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
@@ -1954,7 +1954,7 @@ EOF
 
 	(cd $testroot/wt && got histedit -F "$testroot/histedit-script" \
 		> /dev/null)
-	ret="$?"
+	ret=$?
 	if [ "$?" != 0 ]; then
 		echo "got histedit failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
@@ -1963,8 +1963,8 @@ EOF
 
 	cp $testroot/wt/alpha $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
blob - f90827299e298d8d6dcedf838627c59d16f80333
blob + 5fd35f7af5ce6affa60ec097e6dc2a85866e1596
--- regress/cmdline/import.sh
+++ regress/cmdline/import.sh
@@ -27,8 +27,8 @@ test_import_basic() {
 
 	got import -m 'init' -r $testroot/repo $testroot/tree \
 		> $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -42,8 +42,8 @@ test_import_basic() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -93,8 +93,8 @@ test_import_basic() {
 	echo "" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -109,15 +109,15 @@ test_import_basic() {
 	echo "Now shut up and hack" >> $testroot/stdout.expected
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -131,8 +131,8 @@ test_import_basic() {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -146,8 +146,8 @@ test_import_requires_new_branch() {
 
 	got import -b master -m 'init' -r $testroot/repo $testroot/tree \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "import command should have failed but did not"
 		test_done "$testroot" "1"
 		return 1
@@ -156,8 +156,8 @@ test_import_requires_new_branch() {
 	echo "got: import target branch already exists" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -165,7 +165,7 @@ test_import_requires_new_branch() {
 
 	got import -b newbranch -m 'init' -r $testroot/repo $testroot/tree  \
 		> $testroot/stdout
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 
 }
@@ -181,8 +181,8 @@ test_import_ignores() {
 
 	got import -I alpha -I '*lta*' -I '*silon' \
 		-m 'init' -r $testroot/repo $testroot/tree > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -193,8 +193,8 @@ test_import_ignores() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -211,8 +211,8 @@ test_import_empty_dir() {
 	echo "alpha" > $testroot/tree/notempty/alpha
 
 	got import -m 'init' -r $testroot/repo $testroot/tree > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -223,8 +223,8 @@ test_import_empty_dir() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -236,8 +236,8 @@ test_import_empty_dir() {
 
 	got tree -r $testroot/repo -R > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -255,8 +255,8 @@ test_import_symlink() {
 
 	got import -m 'init' -r $testroot/repo $testroot/tree \
 		> $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -268,8 +268,8 @@ test_import_symlink() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -286,8 +286,8 @@ test_import_symlink() {
 	echo "$id_alpha_link alpha.link@ -> alpha" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 603d7296146a6348c4964490d45c51c943f89e96
blob + 59f3d74f6c80fbf6c7182efae1d36295d9a4134f
--- regress/cmdline/integrate.sh
+++ regress/cmdline/integrate.sh
@@ -38,15 +38,15 @@ test_integrate_basic() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rebase newbranch > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rebase failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -57,8 +57,8 @@ test_integrate_basic() {
 	local new_commit2=`git_show_head $testroot/repo`
 
 	(cd $testroot/wt && got update -b master > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -73,8 +73,8 @@ test_integrate_basic() {
 	echo "Integrated refs/heads/newbranch into refs/heads/master" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -83,8 +83,8 @@ test_integrate_basic() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -93,8 +93,8 @@ test_integrate_basic() {
 	echo "modified alpha on branch" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -109,8 +109,8 @@ test_integrate_basic() {
 	echo "new file on branch" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -120,8 +120,8 @@ test_integrate_basic() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -133,8 +133,8 @@ test_integrate_basic() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $master_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -143,8 +143,8 @@ test_integrate_basic() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 	echo "Already up-to-date" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -177,16 +177,16 @@ test_integrate_requires_rebase_first() {
 	local new_commit2=`git_show_head $testroot/repo`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got integrate newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got integrate succeeded unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -194,8 +194,8 @@ test_integrate_requires_rebase_first() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -204,8 +204,8 @@ test_integrate_requires_rebase_first() {
 	echo "got: specified branch must be rebased first" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -216,8 +216,8 @@ test_integrate_requires_rebase_first() {
 	echo "commit $master_commit (master)" > $testroot/stdout.expected
 	echo "commit $init_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -230,16 +230,16 @@ test_integrate_requires_rebase_first() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $init_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && got branch -l > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rebase failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -248,8 +248,8 @@ test_integrate_requires_rebase_first() {
 	echo "  master: $master_commit" > $testroot/stdout.expected
 	echo "  newbranch: $new_commit2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -277,15 +277,15 @@ test_integrate_path_prefix() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rebase newbranch > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rebase failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -298,8 +298,8 @@ test_integrate_path_prefix() {
 	rm -r $testroot/wt
 	got checkout -b master -p epsilon $testroot/repo $testroot/wt \
 		> /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -311,8 +311,8 @@ test_integrate_path_prefix() {
 	echo "Integrated refs/heads/newbranch into refs/heads/master" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -340,15 +340,15 @@ test_integrate_backwards_in_time() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rebase newbranch > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rebase failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -360,8 +360,8 @@ test_integrate_backwards_in_time() {
 
 	# attempt to integrate master into newbranch (wrong way around)
 	(cd $testroot/wt && got update -b newbranch > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly"
 		test_done "$testroot" "$ret"
 	 return 1
@@ -369,8 +369,8 @@ test_integrate_backwards_in_time() {
 
 	(cd $testroot/wt && got integrate master \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got integrate succeeded unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -378,8 +378,8 @@ test_integrate_backwards_in_time() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -388,8 +388,8 @@ test_integrate_backwards_in_time() {
 	echo "got: specified branch must be rebased first" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -399,8 +399,8 @@ test_integrate_replace_symlink_with_file() {
 	local testroot=`test_init integrate_replace_symlink_with_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -426,8 +426,8 @@ test_integrate_replace_symlink_with_file() {
 		>> $testroot/stdout.expected
 	echo "into refs/heads/master" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -443,8 +443,8 @@ test_integrate_replace_symlink_with_file() {
 	cat $testroot/wt/alpha.link > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -454,8 +454,8 @@ test_integrate_replace_file_with_symlink() {
 	local testroot=`test_init integrate_replace_file_with_symlink`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -476,8 +476,8 @@ test_integrate_replace_file_with_symlink() {
 		>> $testroot/stdout.expected
 	echo "into refs/heads/master" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -492,8 +492,8 @@ test_integrate_replace_file_with_symlink() {
 	readlink $testroot/wt/alpha > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - fb11f286780b130bb30e7694ace57e52e5548050
blob + f13bd9029079658e7f658b35c11dc4ca7a6f70f7
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
@@ -26,8 +26,8 @@ test_log_in_repo() {
 		(cd $testroot/repo && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -38,8 +38,8 @@ test_log_in_repo() {
 		(cd $testroot/repo/epsilon && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -59,8 +59,8 @@ test_log_in_bare_repo() {
 		(cd $testroot/repo/.git && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -81,8 +81,8 @@ test_log_in_worktree() {
 	local head_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -93,8 +93,8 @@ test_log_in_worktree() {
 		(cd $testroot/wt && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -105,8 +105,8 @@ test_log_in_worktree() {
 		(cd $testroot/wt/epsilon && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -117,8 +117,8 @@ test_log_in_worktree() {
 		(cd $testroot/wt/epsilon && got log d/$p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -141,8 +141,8 @@ test_log_in_worktree_with_path_prefix() {
 	local delta_rev=`git_show_head $testroot/repo`
 
 	got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -153,8 +153,8 @@ test_log_in_worktree_with_path_prefix() {
 
 	(cd $testroot/wt && got log | grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -167,8 +167,8 @@ test_log_in_worktree_with_path_prefix() {
 		(cd $testroot/wt && got log $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -185,8 +185,8 @@ test_log_tag() {
 	local tag2="2.0.0"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -197,8 +197,8 @@ test_log_tag() {
 	(cd $testroot/wt && got log -l1 -c $tag | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -212,8 +212,8 @@ test_log_tag() {
 	(cd $testroot/wt && got log -l1 -c $tag2 | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -224,8 +224,8 @@ test_log_limit() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -247,8 +247,8 @@ test_log_limit() {
 	echo "commit $commit_id3 (master)" > $testroot/stdout.expected
 	(cd $testroot/wt && got log -l1 | grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -260,8 +260,8 @@ test_log_limit() {
 	(cd $testroot/wt && env GOT_LOG_DEFAULT_LIMIT=2 got log | \
 		grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -275,8 +275,8 @@ test_log_limit() {
 	echo "commit $commit_id1" >> $testroot/stdout.expected
 	echo "commit $commit_id0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -290,8 +290,8 @@ test_log_limit() {
 	(cd $testroot/wt && env GOT_LOG_DEFAULT_LIMIT=1 got log -l0 | \
 		grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "0"
@@ -302,8 +302,8 @@ test_log_patch_added_file() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -316,16 +316,16 @@ test_log_patch_added_file() {
 	echo "commit $commit_id1 (master)" > $testroot/stdout.expected
 	# This used to fail with 'got: no such entry found in tree'
 	(cd $testroot/wt && got log -l1 -p new > $testroot/stdout.patch)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got log command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	grep ^commit $testroot/stdout.patch > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -339,8 +339,8 @@ test_log_nonexistent_path() {
 
 	(cd $testroot/repo && got log this/does/not/exist \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "log command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -348,8 +348,8 @@ test_log_nonexistent_path() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -358,8 +358,8 @@ test_log_nonexistent_path() {
 	echo "got: this/does/not/exist: no such entry found in tree" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -370,8 +370,8 @@ test_log_end_at_commit() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -394,8 +394,8 @@ test_log_end_at_commit() {
 	(cd $testroot/wt && got log -x $commit_id3 | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -408,8 +408,8 @@ test_log_end_at_commit() {
 	(cd $testroot/wt && got log -c $commit_id3 -x $commit_id1 | \
 		grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -426,8 +426,8 @@ test_log_end_at_commit() {
 	(cd $testroot/wt && got log -x foo | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -438,8 +438,8 @@ test_log_end_at_commit() {
 	(cd $testroot/repo && got log -c foo -x foo | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -454,8 +454,8 @@ test_log_end_at_commit() {
 	(cd $testroot/repo && got log -x foo | grep ^commit \
 		> $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -464,8 +464,8 @@ test_log_end_at_commit() {
 	# got will refuse -x with a non-existent commit
 	(cd $testroot/wt && got log -x nonexistent \
 		> $testroot/stdout 2> $testroot/stderr) 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "log command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -474,15 +474,15 @@ test_log_end_at_commit() {
 	echo "got: reference nonexistent not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -493,8 +493,8 @@ test_log_end_at_commit() {
 	local empty_sha1=da39a3ee5e6b4b0d3255bfef95601890afd80709 
 	(cd $testroot/wt && got log -x $empty_sha1 \
 		> $testroot/stdout 2> $testroot/stderr) 
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "log command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -503,15 +503,15 @@ test_log_end_at_commit() {
 	echo "got: commit $empty_sha1: object not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -525,8 +525,8 @@ test_log_reverse_display() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -551,8 +551,8 @@ test_log_reverse_display() {
 	echo "commit $commit_id3 (master)" >> $testroot/stdout.expected
 	(cd $testroot/wt && got log -R | grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -563,8 +563,8 @@ test_log_reverse_display() {
 	echo "commit $commit_id3 (master)" >> $testroot/stdout.expected
 	(cd $testroot/wt && got log -R -l2 | grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -577,8 +577,8 @@ test_log_reverse_display() {
 	(cd $testroot/wt && got log -R -c $commit_id3 -x $commit_id1 | \
 		grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -590,8 +590,8 @@ test_log_reverse_display() {
 	(cd $testroot/wt && got log -R -s 'commit[12]' | \
 		grep ^commit > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -613,8 +613,8 @@ test_log_reverse_display() {
 	echo "commit $commit_id3 (master)" >> $testroot/stdout.expected
 	echo " A  new" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -635,8 +635,8 @@ test_log_in_worktree_different_repo() {
 	make_test_tree $testroot/tree
 	got import -mm -b foo -r $testroot/other-repo $testroot/tree >/dev/null
 	got checkout -b foo $testroot/other-repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -650,8 +650,8 @@ test_log_in_worktree_different_repo() {
 		(cd $testroot/wt && got log -r $testroot/repo $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -662,8 +662,8 @@ test_log_in_worktree_different_repo() {
 		(cd $testroot/wt/epsilon && got log -r $testroot/repo $p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -674,8 +674,8 @@ test_log_in_worktree_different_repo() {
 		(cd $testroot/wt/epsilon && got log -r $testroot/repo epsilon/d/$p | \
 			grep ^commit > $testroot/stdout)
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -690,8 +690,8 @@ test_log_changed_paths() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -722,8 +722,8 @@ test_log_changed_paths() {
 	echo " A  gamma/delta" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -742,8 +742,8 @@ test_log_submodule() {
 
 	got log -r $testroot/repo -l1 repo2 | grep ^commit > $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -754,8 +754,8 @@ test_log_submodule() {
 	got log -r $testroot/repo -l1 -P repo2 | grep '^ [MDmA]' \
 		> $testroot/stdout
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -763,8 +763,8 @@ test_log_submodule() {
 
 	got log -p -r $testroot/repo -l1 repo2 \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "log command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -774,8 +774,8 @@ test_log_submodule() {
 	echo "got: object $submodule_id not found" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -791,8 +791,8 @@ test_log_submodule() {
 
 	# log -P does not show the changed submodule path
 	got log -P -r $testroot/repo -l1 repo2 > $testroot/stdout.full
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "log command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -801,8 +801,8 @@ test_log_submodule() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - e56a0bd381bdbeb93ee755f1e1279e9598388578
blob + 0d03d0c83a725429e9a8d665b4e26dcbfe287e8c
--- regress/cmdline/merge.sh
+++ regress/cmdline/merge.sh
@@ -45,8 +45,8 @@ test_merge_basic() {
 	local branch_commit5=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -55,8 +55,8 @@ test_merge_basic() {
 	# need a divergant commit on the main branch for 'got merge' 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -69,8 +69,8 @@ test_merge_basic() {
 		>> $testroot/stderr.expected
 	echo "'got integrate' instead" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -85,8 +85,8 @@ test_merge_basic() {
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -95,16 +95,16 @@ test_merge_basic() {
 		> $testroot/stderr.expected
 	echo "to merge a branch" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -112,16 +112,16 @@ test_merge_basic() {
 
 	# must not use a mixed-commit work tree with 'got merge' 
 	(cd $testroot/wt && got update -c $commit0 alpha > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -131,16 +131,16 @@ test_merge_basic() {
 	echo "the entire work tree must be updated first" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -149,31 +149,31 @@ test_merge_basic() {
 	# must not have staged files with 'got merge' 
 	echo "modified file alpha"  > $testroot/wt/alpha
 	(cd $testroot/wt && got stage alpha > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo "got: alpha: file is staged" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	(cd $testroot/wt && got unstage alpha > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -182,8 +182,8 @@ test_merge_basic() {
 	# must not have local changes with 'got merge' 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -193,24 +193,24 @@ test_merge_basic() {
 	echo "these changes must be committed or reverted first" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got revert alpha > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got merge newbranch > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -229,8 +229,8 @@ test_merge_basic() {
 	echo $merge_commit >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -239,8 +239,8 @@ test_merge_basic() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -249,8 +249,8 @@ test_merge_basic() {
 	echo "modified alpha on branch" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -265,8 +265,8 @@ test_merge_basic() {
 	echo "new file on branch" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -281,8 +281,8 @@ test_merge_basic() {
 	readlink $testroot/wt/symlink > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -292,8 +292,8 @@ test_merge_basic() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -304,8 +304,8 @@ test_merge_basic() {
 	echo "commit $master_commit" >> $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -318,8 +318,8 @@ test_merge_basic() {
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -337,16 +337,16 @@ test_merge_basic() {
 	echo "parent 1: $master_commit" > $testroot/stdout.expected
 	echo "parent 2: $branch_commit5" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got tree -r $testroot/repo -c $merge_commit -R > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got tree failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -364,8 +364,8 @@ gamma/delta
 symlink@ -> alpha
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -393,8 +393,8 @@ test_merge_continue() {
 	local branch_commit3=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -408,8 +408,8 @@ test_merge_continue() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -417,8 +417,8 @@ test_merge_continue() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -430,8 +430,8 @@ test_merge_continue() {
 	echo "G  gamma/delta" >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -440,8 +440,8 @@ test_merge_continue() {
 	echo "got: conflicts must be resolved before merging can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -454,8 +454,8 @@ test_merge_continue() {
 	echo "A  epsilon/new" >> $testroot/stdout.expected
 	echo "M  gamma/delta" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -472,8 +472,8 @@ test_merge_continue() {
 		>> $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -483,8 +483,8 @@ test_merge_continue() {
 	echo "modified alpha by both branches" > $testroot/wt/alpha
 
 	(cd $testroot/wt && got merge -c > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -501,8 +501,8 @@ test_merge_continue() {
 	echo $merge_commit >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -511,8 +511,8 @@ test_merge_continue() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -521,8 +521,8 @@ test_merge_continue() {
 	echo "modified alpha by both branches" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -537,8 +537,8 @@ test_merge_continue() {
 	echo "new file on branch" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -548,8 +548,8 @@ test_merge_continue() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -560,8 +560,8 @@ test_merge_continue() {
 	echo "commit $master_commit" >> $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -571,8 +571,8 @@ test_merge_continue() {
 
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -583,8 +583,8 @@ test_merge_continue() {
 	echo "parent 1: $master_commit" > $testroot/stdout.expected
 	echo "parent 2: $branch_commit3" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -615,8 +615,8 @@ test_merge_abort() {
 	local branch_commit4=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -633,8 +633,8 @@ test_merge_abort() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -642,8 +642,8 @@ test_merge_abort() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -656,8 +656,8 @@ test_merge_abort() {
 	echo "A  symlink" >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -666,8 +666,8 @@ test_merge_abort() {
 	echo "got: conflicts must be resolved before merging can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -682,16 +682,16 @@ test_merge_abort() {
 	echo "A  symlink" >> $testroot/stdout.expected
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got merge -a > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -706,8 +706,8 @@ test_merge_abort() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -716,8 +716,8 @@ test_merge_abort() {
 	echo "delta" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -726,8 +726,8 @@ test_merge_abort() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -736,8 +736,8 @@ test_merge_abort() {
 	echo "beta" > $testroot/content.expected
 	cat $testroot/wt/beta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -759,8 +759,8 @@ test_merge_abort() {
 
 	echo "?  unversioned-file" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -770,8 +770,8 @@ test_merge_abort() {
 	echo "commit $master_commit (master)" > $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -781,8 +781,8 @@ test_merge_abort() {
 
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -799,8 +799,8 @@ test_merge_in_progress() {
 	local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -814,8 +814,8 @@ test_merge_in_progress() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -823,8 +823,8 @@ test_merge_in_progress() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -833,8 +833,8 @@ test_merge_in_progress() {
 	echo "C  alpha" >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -843,8 +843,8 @@ test_merge_in_progress() {
 	echo "got: conflicts must be resolved before merging can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -854,8 +854,8 @@ test_merge_in_progress() {
 
 	echo "C  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -868,8 +868,8 @@ test_merge_in_progress() {
 
 		echo -n > $testroot/stdout.expected
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -880,8 +880,8 @@ test_merge_in_progress() {
 		echo "work tree and must be continued or aborted first" \
 			>> $testroot/stderr.expected
 		cmp -s $testroot/stderr.expected $testroot/stderr
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
 			return 1
@@ -903,8 +903,8 @@ test_merge_path_prefix() {
 
 	got checkout -p epsilon -b master $testroot/repo $testroot/wt \
 		> /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -918,8 +918,8 @@ test_merge_path_prefix() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -927,8 +927,8 @@ test_merge_path_prefix() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -938,8 +938,8 @@ test_merge_path_prefix() {
 		> $testroot/stderr.expected
 	echo "of this work tree's path prefix" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -957,8 +957,8 @@ test_merge_missing_file() {
 	local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -972,8 +972,8 @@ test_merge_missing_file() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -981,8 +981,8 @@ test_merge_missing_file() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -994,8 +994,8 @@ test_merge_missing_file() {
 		>> $testroot/stdout.expected
 	echo "in the work tree: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1008,8 +1008,8 @@ test_merge_missing_file() {
 	echo "required before the merge operation is continued" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1019,8 +1019,8 @@ test_merge_missing_file() {
 
 	echo "M  gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1040,8 +1040,8 @@ test_merge_no_op() {
 	local branch_commitk=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1055,8 +1055,8 @@ test_merge_no_op() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1064,8 +1064,8 @@ test_merge_no_op() {
 
 	(cd $testroot/wt && got merge newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1074,8 +1074,8 @@ test_merge_no_op() {
 	echo "C  alpha" >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1084,8 +1084,8 @@ test_merge_no_op() {
 	echo "got: conflicts must be resolved before merging can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1095,8 +1095,8 @@ test_merge_no_op() {
 
 	echo "C  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1104,8 +1104,8 @@ test_merge_no_op() {
 
 	# resolve the conflict by reverting all changes; now it is no-op merge
 	(cd $testroot/wt && got revert alpha > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1113,8 +1113,8 @@ test_merge_no_op() {
 
 	(cd $testroot/wt && got merge -c > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got merge succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1124,8 +1124,8 @@ test_merge_no_op() {
 		> $testroot/stderr.expected
 	echo "no changes to commit" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1135,8 +1135,8 @@ test_merge_no_op() {
 
 	echo -n "" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1159,16 +1159,16 @@ test_merge_imported_branch() {
 		$testroot/tree > /dev/null
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got merge files > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1182,8 +1182,8 @@ A  there/should
 Merged refs/heads/files into refs/heads/master: $merge_commit0
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1191,16 +1191,16 @@ EOF
 
 	# try to merge again while no new changes are available
 	(cd $testroot/wt && got merge files > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo "Already up-to-date" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1216,8 +1216,8 @@ EOF
 	git_commit $testroot/repo -m "lots of changes"
 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1225,8 +1225,8 @@ EOF
 
 	# we should now be able to merge more changes from files branch
 	(cd $testroot/wt && got merge files > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1240,8 +1240,8 @@ Merged refs/heads/files into refs/heads/master: $merge
 EOF
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1258,8 +1258,8 @@ test_merge_interrupt() {
 	local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
 
 	got checkout -b master $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1273,8 +1273,8 @@ test_merge_interrupt() {
 
 	# need an up-to-date work tree for 'got merge' 
 	(cd $testroot/wt && got update > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1282,8 +1282,8 @@ test_merge_interrupt() {
 
 	(cd $testroot/wt && got merge -n newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1293,8 +1293,8 @@ test_merge_interrupt() {
 	echo "Merge of refs/heads/newbranch interrupted on request" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1304,8 +1304,8 @@ test_merge_interrupt() {
 
 	echo "M  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1314,8 +1314,8 @@ test_merge_interrupt() {
 	echo "modified alpha on branch" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1326,8 +1326,8 @@ test_merge_interrupt() {
 
 	# continue the merge
 	(cd $testroot/wt && got merge -c > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got merge failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1341,8 +1341,8 @@ test_merge_interrupt() {
 	echo $merge_commit >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1352,8 +1352,8 @@ test_merge_interrupt() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1364,8 +1364,8 @@ test_merge_interrupt() {
 	echo "commit $master_commit" >> $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1375,8 +1375,8 @@ test_merge_interrupt() {
 
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1387,8 +1387,8 @@ test_merge_interrupt() {
 	echo "parent 1: $master_commit" > $testroot/stdout.expected
 	echo "parent 2: $branch_commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 2ac3207e191fd1b940a418ffd18b2c0b82a89dff
blob + 3f911d52d624e56029f65b90ea0a9203bbf8def6
--- regress/cmdline/pack.sh
+++ regress/cmdline/pack.sh
@@ -27,23 +27,23 @@ test_pack_all_loose_objects() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	gotadmin pack -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -64,7 +64,7 @@ test_pack_all_loose_objects() {
 			ret=1
 			break
 		done
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
@@ -78,30 +78,30 @@ test_pack_exclude() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -110,8 +110,8 @@ test_pack_exclude() {
 	(cd $testroot/wt && got commit -m "edit alpha" >/dev/null)
 
 	gotadmin pack -r $testroot/repo -x master > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -131,11 +131,11 @@ test_pack_exclude() {
 			echo "found excluded object $id in pack file" >&2
 			ret=1
 		fi
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
-	if [ "$ret" = "1" ]; then
+	if [ $ret -eq 1 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -162,7 +162,7 @@ test_pack_exclude() {
 			ret=1
 			break
 		done
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
@@ -176,30 +176,30 @@ test_pack_include() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -209,8 +209,8 @@ test_pack_include() {
 	local commit1=`git_show_branch_head $testroot/repo mybranch`
 
 	gotadmin pack -r $testroot/repo master > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -230,11 +230,11 @@ test_pack_include() {
 			echo "found excluded object $id in pack file" >&2
 			ret=1
 		fi
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
-	if [ "$ret" = "1" ]; then
+	if [ $ret -eq 1 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -271,30 +271,30 @@ test_pack_ambiguous_arg() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -305,8 +305,8 @@ test_pack_ambiguous_arg() {
 
 	gotadmin pack -r $testroot/repo -x master master \
 		> /dev/null 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "gotadmin pack succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -314,8 +314,8 @@ test_pack_ambiguous_arg() {
 
 	echo "gotadmin: not enough objects to pack" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -327,30 +327,30 @@ test_pack_loose_only() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -362,16 +362,16 @@ test_pack_loose_only() {
 	# should then be excluded while packing 'mybranch' since they
 	# are already packed
 	gotadmin pack -r $testroot/repo master > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	gotadmin pack -r $testroot/repo mybranch > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -391,11 +391,11 @@ test_pack_loose_only() {
 			echo "found excluded object $id in pack file" >&2
 			ret=1
 		fi
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
-	if [ "$ret" = "1" ]; then
+	if [ $ret -eq 1 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -422,7 +422,7 @@ test_pack_loose_only() {
 			ret=1
 			break
 		done
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
@@ -436,30 +436,30 @@ test_pack_all_objects() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -469,8 +469,8 @@ test_pack_all_objects() {
 
 	# pack objects belonging to the 'master' branch
 	gotadmin pack -r $testroot/repo master > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -479,8 +479,8 @@ test_pack_all_objects() {
 	# pack mybranch, including already packed objects on the
 	# 'master' branch which are reachable from mybranch
 	gotadmin pack -r $testroot/repo -a mybranch > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "gotadmin pack failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -501,7 +501,7 @@ test_pack_all_objects() {
 			ret=1
 			break
 		done
-		if [ "$ret" = "1" ]; then
+		if [ $ret -eq 1 ]; then
 			break
 		fi
 	done
@@ -515,38 +515,38 @@ test_pack_bad_ref() {
 
 	# no pack files should exist yet
 	ls $testroot/repo/.git/objects/pack/ > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got branch -r $testroot/repo mybranch
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got checkout -b mybranch $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	gotadmin pack -r $testroot/repo refs/got/worktree/ \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "gotadmin pack succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -554,8 +554,8 @@ test_pack_bad_ref() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -563,8 +563,8 @@ test_pack_bad_ref() {
 
 	echo "gotadmin: not enough objects to pack" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
blob - c629d068ddf4ae78f0a2184ea064823c4c1926de
blob + 5e74b959165a7294b2db81a0c1423f2573dd875f
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
@@ -41,8 +41,8 @@ test_rebase_basic() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -74,8 +74,8 @@ test_rebase_basic() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -84,8 +84,8 @@ test_rebase_basic() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -94,8 +94,8 @@ test_rebase_basic() {
 	echo "modified alpha on branch" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -110,8 +110,8 @@ test_rebase_basic() {
 	echo "new file on branch" > $testroot/content.expected
 	cat $testroot/wt/epsilon/new > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -121,8 +121,8 @@ test_rebase_basic() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -133,8 +133,8 @@ test_rebase_basic() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $master_commit (master)" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -144,8 +144,8 @@ test_rebase_basic() {
 
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -170,8 +170,8 @@ history forked at $commit0
  $d_0 $GOT_AUTHOR_11  adding the test tree
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -184,15 +184,15 @@ EOF
 	echo "got: refs/got/backup/rebase/master/: no such reference found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -206,15 +206,15 @@ EOF
 	echo "$orig_commit2" >> $testroot/stdout.expected
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -223,8 +223,8 @@ EOF
 	(cd $testroot/repo && got rebase -l > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -234,8 +234,8 @@ test_rebase_ancestry_check() {
 	local testroot=`test_init rebase_ancestry_check`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -256,8 +256,8 @@ test_rebase_ancestry_check() {
 	echo "Updated to refs/heads/newbranch: ${newbranch_id}" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -265,8 +265,8 @@ test_rebase_ancestry_check() {
 
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -288,8 +288,8 @@ test_rebase_continue() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -303,8 +303,8 @@ test_rebase_continue() {
 		>> $testroot/stdout.expected
 	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -313,8 +313,8 @@ test_rebase_continue() {
 	echo "got: conflicts must be resolved before rebasing can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -331,8 +331,8 @@ test_rebase_continue() {
 		>> $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -342,8 +342,8 @@ test_rebase_continue() {
 
 	echo "C  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -356,8 +356,8 @@ test_rebase_continue() {
 	(cd $testroot/wt && got stage alpha > /dev/null)
 	(cd $testroot/wt && got rebase -c > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "rebase succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -367,8 +367,8 @@ test_rebase_continue() {
 	echo "these changes must be committed or unstaged first" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -388,8 +388,8 @@ test_rebase_continue() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -400,8 +400,8 @@ test_rebase_continue() {
 	echo "commit $new_commit1 (newbranch)" > $testroot/stdout.expected
 	echo "commit $master_commit (master)" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -424,8 +424,8 @@ test_rebase_abort() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -442,8 +442,8 @@ test_rebase_abort() {
 		>> $testroot/stdout.expected
 	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -452,8 +452,8 @@ test_rebase_abort() {
 	echo "got: conflicts must be resolved before rebasing can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -470,8 +470,8 @@ test_rebase_abort() {
 		>> $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -482,8 +482,8 @@ test_rebase_abort() {
 	echo "C  alpha" > $testroot/stdout.expected
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -500,8 +500,8 @@ test_rebase_abort() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -510,8 +510,8 @@ test_rebase_abort() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -522,8 +522,8 @@ test_rebase_abort() {
 	echo "commit $orig_commit1 (newbranch)" > $testroot/stdout.expected
 	echo "commit $init_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -545,8 +545,8 @@ test_rebase_no_op_change() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -560,8 +560,8 @@ test_rebase_no_op_change() {
 		>> $testroot/stdout.expected
 	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -570,8 +570,8 @@ test_rebase_no_op_change() {
 	echo "got: conflicts must be resolved before rebasing can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -588,8 +588,8 @@ test_rebase_no_op_change() {
 		>> $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -599,8 +599,8 @@ test_rebase_no_op_change() {
 
 	echo "C  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -621,8 +621,8 @@ test_rebase_no_op_change() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -634,8 +634,8 @@ test_rebase_no_op_change() {
 		> $testroot/stdout.expected
 	echo "commit $init_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -657,8 +657,8 @@ test_rebase_in_progress() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -672,8 +672,8 @@ test_rebase_in_progress() {
 		>> $testroot/stdout.expected
 	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -682,8 +682,8 @@ test_rebase_in_progress() {
 	echo "got: conflicts must be resolved before rebasing can continue" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -700,8 +700,8 @@ test_rebase_in_progress() {
 		>> $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -711,8 +711,8 @@ test_rebase_in_progress() {
 
 	echo "C  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -724,8 +724,8 @@ test_rebase_in_progress() {
 
 		echo -n > $testroot/stdout.expected
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -736,8 +736,8 @@ test_rebase_in_progress() {
 		echo "work tree and must be continued or aborted first" \
 			>> $testroot/stderr.expected
 		cmp -s $testroot/stderr.expected $testroot/stderr
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
 			return 1
@@ -763,8 +763,8 @@ test_rebase_path_prefix() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -774,8 +774,8 @@ test_rebase_path_prefix() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -785,8 +785,8 @@ test_rebase_path_prefix() {
 		> $testroot/stderr.expected
 	echo "of this work tree's path prefix" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -814,8 +814,8 @@ test_rebase_preserves_logmsg() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -829,8 +829,8 @@ test_rebase_preserves_logmsg() {
 
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -841,8 +841,8 @@ test_rebase_preserves_logmsg() {
 	sed -i -e "s/$orig_commit1/$new_commit1/" $testroot/log.expected
 	sed -i -e "s/$orig_commit2/$new_commit2/" $testroot/log.expected
 	cmp -s $testroot/log.expected $testroot/log
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/log.expected $testroot/log
 	fi
 
@@ -853,8 +853,8 @@ test_rebase_no_commits_to_rebase() {
 	local testroot=`test_init rebase_no_commits_to_rebase`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -871,8 +871,8 @@ test_rebase_no_commits_to_rebase() {
 
 	echo "got: no commits to rebase" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -881,8 +881,8 @@ test_rebase_no_commits_to_rebase() {
 	echo "Rebase of refs/heads/newbranch aborted" \
 		> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -891,8 +891,8 @@ test_rebase_no_commits_to_rebase() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 	echo "Already up-to-date" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -903,8 +903,8 @@ test_rebase_forward() {
 	local commit0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -938,8 +938,8 @@ test_rebase_forward() {
 	echo "Switching work tree to refs/heads/master" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -950,16 +950,16 @@ test_rebase_forward() {
 		> $testroot/stdout 2> $testroot/stderr)
 	echo -n "" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo "got: rebase operation not in progress" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -968,8 +968,8 @@ test_rebase_forward() {
 	(cd $testroot/wt && got branch -n > $testroot/stdout)
 	echo "master" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -980,8 +980,8 @@ test_rebase_forward() {
 	echo "commit $commit1" >> $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -991,8 +991,8 @@ test_rebase_forward() {
 	(cd $testroot/repo && got rebase -l > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1027,8 +1027,8 @@ test_rebase_out_of_date() {
 
 	got checkout -c $master_commit1 $testroot/repo $testroot/wt \
 		> /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1038,8 +1038,8 @@ test_rebase_out_of_date() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1049,8 +1049,8 @@ test_rebase_out_of_date() {
 		> $testroot/stderr.expected
 	echo "used to rebase a branch" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1061,8 +1061,8 @@ test_rebase_out_of_date() {
 	echo "commit $master_commit1" >> $testroot/stdout.expected
 	echo "commit $initial_commit" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1087,8 +1087,8 @@ test_rebase_trims_empty_dir() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1117,8 +1117,8 @@ test_rebase_trims_empty_dir() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1127,8 +1127,8 @@ test_rebase_trims_empty_dir() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1137,8 +1137,8 @@ test_rebase_trims_empty_dir() {
 	echo "modified alpha on master" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1154,8 +1154,8 @@ test_rebase_trims_empty_dir() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1166,8 +1166,8 @@ test_rebase_trims_empty_dir() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $master_commit (master)" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1212,8 +1212,8 @@ test_rebase_delete_missing_file() {
 	(cd $testroot/wt && got update -b master > /dev/null)
 	(cd $testroot/wt && got rebase newbranch > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "rebase succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1235,8 +1235,8 @@ test_rebase_delete_missing_file() {
 		>> $testroot/stdout.expected
 	echo "in the work tree: 2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1248,8 +1248,8 @@ test_rebase_delete_missing_file() {
 		>> $testroot/stderr.expected
 	echo "rebase operation is continued" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1257,8 +1257,8 @@ test_rebase_delete_missing_file() {
 
 	# ignore the missing changes and continue
 	(cd $testroot/wt && got rebase -c > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "rebase failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1271,8 +1271,8 @@ test_rebase_delete_missing_file() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1281,8 +1281,8 @@ test_rebase_delete_missing_file() {
 	echo "modified delta on branch" > $testroot/content.expected
 	cat $testroot/wt/gamma/delta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1298,8 +1298,8 @@ test_rebase_delete_missing_file() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1314,8 +1314,8 @@ test_rebase_delete_missing_file() {
 	echo "commit $master_commit (master)" >> $testroot/stdout.expected
 	echo "commit $commit0" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1344,8 +1344,8 @@ test_rebase_rm_add_rm_file() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1354,8 +1354,8 @@ test_rebase_rm_add_rm_file() {
 
 	# this would error out with 'got: file index is corrupt'
 	(cd $testroot/wt && got status > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got status command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1391,16 +1391,16 @@ test_rebase_rm_add_rm_file() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got status > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got status command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1408,8 +1408,8 @@ test_rebase_rm_add_rm_file() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1421,8 +1421,8 @@ test_rebase_rm_add_rm_file() {
 	echo "commit $new_commit1" >> $testroot/stdout.expected
 	echo "commit $master_commit (master)" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 10a8438410f2c35df7e8078209395627a43d2cb8
blob + 85881196beb482de5fdcb7e3c4ec5112a287758c
--- regress/cmdline/ref.sh
+++ regress/cmdline/ref.sh
@@ -22,8 +22,8 @@ test_ref_create() {
 
 	# Create a ref pointing at a commit ID
 	got ref -r $testroot/repo -c $commit_id refs/heads/commitref
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -31,8 +31,8 @@ test_ref_create() {
 
 	# Create a ref based on repository's HEAD reference
 	got ref -r $testroot/repo -c HEAD refs/heads/newref
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -40,8 +40,8 @@ test_ref_create() {
 
 	# Ensure that Git recognizes the ref Got has created
 	(cd $testroot/repo && git checkout -q newref)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -49,8 +49,8 @@ test_ref_create() {
 
 	# Ensure Got recognizes the new ref
 	got checkout -b newref $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -58,15 +58,15 @@ test_ref_create() {
 
 	# Create a head ref based on another specific ref
 	(cd $testroot/wt && got ref -c refs/heads/master refs/heads/anotherref)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q anotherref)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -74,15 +74,15 @@ test_ref_create() {
 
 	# Create a symbolic ref
 	(cd $testroot/wt && got ref -s refs/heads/master refs/heads/symbolicref)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q symbolicref)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -91,8 +91,8 @@ test_ref_create() {
 	# Attempt to create a symbolic ref pointing at a non-reference
 	(cd $testroot/wt && got ref -s $commit_id refs/heads/symbolicref \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got ref command succeeded unexpectedly"
 		test_done "$testroot" "1"
 		return 1
@@ -100,8 +100,8 @@ test_ref_create() {
 
 	echo "got: reference $commit_id not found" > $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -109,16 +109,16 @@ test_ref_create() {
 
 	# Attempt to create a reference without specifying a name
 	(cd $testroot/wt && got ref -c $commit_id 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got ref command succeeded unexpectedly"
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	grep -q '^usage: got ref' $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "unexpected usage error message: " >&2
 		cat $testroot/stderr >&2
 		test_done "$testroot" "$ret"
@@ -128,16 +128,16 @@ test_ref_create() {
 	# Attempt to create a symbolic reference without specifying a name
 	(cd $testroot/wt && got ref -s refs/heads/symbolicref \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got ref command succeeded unexpectedly"
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	grep -q '^usage: got ref' $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "unexpected usage error message: " >&2
 		cat $testroot/stderr >&2
 		test_done "$testroot" "$ret"
@@ -146,8 +146,8 @@ test_ref_create() {
 
 	# Change HEAD
 	got ref -r $testroot/repo -s refs/heads/newref HEAD
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -155,8 +155,8 @@ test_ref_create() {
 
 	# Ensure that Git recognizes the ref Got has created
 	(cd $testroot/repo && git checkout -q HEAD)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -164,8 +164,8 @@ test_ref_create() {
 
 	# Ensure Got recognizes the new ref
 	(cd $testroot/wt && got update -b HEAD >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -182,8 +182,8 @@ test_ref_create() {
 	echo "refs/heads/symbolicref: refs/heads/master" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -195,8 +195,8 @@ test_ref_delete() {
 
 	for b in ref1 ref2 ref3; do
 		got ref -r $testroot/repo -c refs/heads/master refs/heads/$b
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got ref command failed unexpectedly"
 			test_done "$testroot" "$ret"
 			return 1
@@ -204,16 +204,16 @@ test_ref_delete() {
 	done
 
 	got ref -d -r $testroot/repo refs/heads/ref2 > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo "Deleted refs/heads/ref2: $commit_id" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -225,8 +225,8 @@ test_ref_delete() {
 	echo "refs/heads/ref1: $commit_id" >> $testroot/stdout.expected
 	echo "refs/heads/ref3: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -234,8 +234,8 @@ test_ref_delete() {
 
 	got ref -r $testroot/repo -d refs/heads/bogus_ref_name \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got ref succeeded unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -244,8 +244,8 @@ test_ref_delete() {
 	echo "got: reference refs/heads/bogus_ref_name not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -265,8 +265,8 @@ test_ref_delete() {
 	echo "refs/heads/ref1: $commit_id" >> $testroot/stdout.expected
 	echo "refs/heads/ref3: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -279,8 +279,8 @@ test_ref_delete() {
 	echo "refs/heads/ref1: $commit_id" >> $testroot/stdout.expected
 	echo "refs/heads/ref3: $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -292,8 +292,8 @@ test_ref_list() {
 
 	# Create a tag pointing at a commit ID
 	got tag -r $testroot/repo -c $commit_id -m "1.0" "1.0" >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got tag command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -303,8 +303,8 @@ test_ref_list() {
 
 	# Create a ref based on repository's HEAD reference
 	got ref -r $testroot/repo -c HEAD refs/foo/zoo
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -312,8 +312,8 @@ test_ref_list() {
 
 	# Create a head ref based on another specific ref
 	(cd $testroot/repo && got ref -c refs/heads/master refs/foo/bar/baz)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -321,8 +321,8 @@ test_ref_list() {
 	# Create a HEAD ref in the namespace of a remote repository
 	(cd $testroot/repo && got ref -s refs/heads/master \
 		refs/remotes/origin/HEAD)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -337,8 +337,8 @@ test_ref_list() {
 		>> $testroot/stdout.expected
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -353,8 +353,8 @@ test_ref_list() {
 		>> $testroot/stdout.expected
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -364,8 +364,8 @@ test_ref_list() {
 
 	echo "refs/tags/1.0: $tag_id" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -376,8 +376,8 @@ test_ref_list() {
 
 		echo "refs/foo/bar/baz: $commit_id" > $testroot/stdout.expected
 		cmp -s $testroot/stdout $testroot/stdout.expected
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -390,8 +390,8 @@ test_ref_list() {
 		echo "refs/foo/bar/baz: $commit_id" > $testroot/stdout.expected
 		echo "refs/foo/zoo: $commit_id" >> $testroot/stdout.expected
 		cmp -s $testroot/stdout $testroot/stdout.expected
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -404,8 +404,8 @@ test_ref_list() {
 
 		echo -n > $testroot/stdout.expected
 		cmp -s $testroot/stdout $testroot/stdout.expected
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -413,8 +413,8 @@ test_ref_list() {
 
 		echo "got: $r: bad reference name" > $testroot/stderr.expected
 		cmp -s $testroot/stderr $testroot/stderr.expected
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
 			return 1
@@ -427,8 +427,8 @@ test_ref_list() {
 
 		echo -n > $testroot/stdout.expected
 		cmp -s $testroot/stdout $testroot/stdout.expected
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
blob - 608abc82cbefff93d4d24717552a9b9a1f703761
blob + 53e50a517d427f5e9cae1a7f8809b8098360d3a8
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
@@ -20,8 +20,8 @@ test_revert_basic() {
 	local testroot=`test_init revert_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -33,8 +33,8 @@ test_revert_basic() {
 	(cd $testroot/wt && got revert epsilon/zeta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -44,8 +44,8 @@ test_revert_basic() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -56,8 +56,8 @@ test_revert_rm() {
 	local testroot=`test_init revert_rm`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -69,8 +69,8 @@ test_revert_rm() {
 	(cd $testroot/wt && got revert beta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -80,8 +80,8 @@ test_revert_rm() {
 	cat $testroot/wt/beta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 		test_done "$testroot" "$ret"
@@ -91,8 +91,8 @@ test_revert_add() {
 	local testroot=`test_init revert_add`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -105,8 +105,8 @@ test_revert_add() {
 	(cd $testroot/wt && got revert new > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -116,8 +116,8 @@ test_revert_add() {
 	cat $testroot/wt/new > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -128,8 +128,8 @@ test_revert_add() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -139,8 +139,8 @@ test_revert_multiple() {
 	local testroot=`test_init revert_multiple`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -154,8 +154,8 @@ test_revert_multiple() {
 	(cd $testroot/wt && got revert alpha epsilon/zeta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -165,8 +165,8 @@ test_revert_multiple() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -176,8 +176,8 @@ test_revert_multiple() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -187,8 +187,8 @@ test_revert_file_in_new_subdir() {
 	local testroot=`test_init revert_file_in_new_subdir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -202,8 +202,8 @@ test_revert_file_in_new_subdir() {
 
 	echo "R  newdir/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -213,8 +213,8 @@ test_revert_file_in_new_subdir() {
 
 	echo "?  newdir/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -225,8 +225,8 @@ test_revert_no_arguments() {
 	local testroot=`test_init revert_no_arguments`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -234,8 +234,8 @@ test_revert_no_arguments() {
 	echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
 
 	(cd $testroot/wt && got revert > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "revert command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -243,8 +243,8 @@ test_revert_no_arguments() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -253,8 +253,8 @@ test_revert_no_arguments() {
 	echo "usage: got revert [-p] [-F response-script] [-R] path ..." \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -264,8 +264,8 @@ test_revert_directory() {
 	local testroot=`test_init revert_directory`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -273,8 +273,8 @@ test_revert_directory() {
 	echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
 
 	(cd $testroot/wt && got revert . > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got revert command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -282,8 +282,8 @@ test_revert_directory() {
 	echo "got: reverting directories requires -R option" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -291,8 +291,8 @@ test_revert_directory() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -302,8 +302,8 @@ test_revert_directory() {
 
 	echo 'R  epsilon/zeta' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -313,8 +313,8 @@ test_revert_directory() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -324,8 +324,8 @@ test_revert_directory_unknown() {
 	local testroot=`test_init revert_directory_unknown`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -339,8 +339,8 @@ test_revert_directory_unknown() {
 	echo 'R  alpha' > $testroot/stdout.expected
 	echo 'R  epsilon/zeta' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -350,8 +350,8 @@ test_revert_directory_unknown() {
 	cat $testroot/wt/epsilon/new_file > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -361,8 +361,8 @@ test_revert_directory_unknown() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 
@@ -378,8 +378,8 @@ test_revert_patch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -394,8 +394,8 @@ test_revert_patch() {
 	printf "n\nn\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got revert -F $testroot/patchscript -p \
 		numbers > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -437,8 +437,8 @@ M  numbers (change 3 of 3)
 revert this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -447,8 +447,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -456,8 +456,8 @@ EOF
 
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	cmp -s $testroot/numbers.diff $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/numbers.diff $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -467,8 +467,8 @@ EOF
 	printf "y\nn\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got revert -F $testroot/patchscript -p \
 		numbers > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -510,8 +510,8 @@ M  numbers (change 3 of 3)
 revert this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -520,8 +520,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -554,8 +554,8 @@ EOF
 EOF
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -606,8 +606,8 @@ M  numbers (change 3 of 3)
 revert this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -616,8 +616,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -649,8 +649,8 @@ EOF
 +c
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -684,8 +684,8 @@ M  numbers (change 2 of 2)
 revert this change? [y/n/q] y
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -711,8 +711,8 @@ EOF
  5
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -723,8 +723,8 @@ test_revert_patch_added() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -739,8 +739,8 @@ test_revert_patch_added() {
 	echo "A  epsilon/new" > $testroot/stdout.expected
 	echo "revert this addition? [y/n] n" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -749,8 +749,8 @@ test_revert_patch_added() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "A  epsilon/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -764,8 +764,8 @@ test_revert_patch_added() {
 	echo "revert this addition? [y/n] y" >> $testroot/stdout.expected
 	echo "R  epsilon/new" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -774,8 +774,8 @@ test_revert_patch_added() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "?  epsilon/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -786,8 +786,8 @@ test_revert_patch_removed() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -800,8 +800,8 @@ test_revert_patch_removed() {
 	echo "D  beta" > $testroot/stdout.expected
 	echo "revert this deletion? [y/n] n" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -810,8 +810,8 @@ test_revert_patch_removed() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "D  beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -825,8 +825,8 @@ test_revert_patch_removed() {
 	echo "revert this deletion? [y/n] y" >> $testroot/stdout.expected
 	echo "R  beta" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -835,8 +835,8 @@ test_revert_patch_removed() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -851,8 +851,8 @@ test_revert_patch_one_change() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -866,8 +866,8 @@ test_revert_patch_one_change() {
 	printf "y\n" > $testroot/patchscript
 	(cd $testroot/wt && got revert -F $testroot/patchscript -p \
 		numbers > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -885,16 +885,16 @@ test_revert_patch_one_change() {
 M  numbers (change 1 of 1)
 revert this change? [y/n/q] y
 EOF
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -903,8 +903,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -913,8 +913,8 @@ EOF
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -924,8 +924,8 @@ test_revert_added_subtree() {
 	local testroot=`test_init revert_added_subtree`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -961,8 +961,8 @@ test_revert_added_subtree() {
 	(cd $testroot/wt && got revert -R . > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -983,8 +983,8 @@ test_revert_added_subtree() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -994,8 +994,8 @@ test_revert_deleted_subtree() {
 	local testroot=`test_init revert_deleted_subtree`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1035,8 +1035,8 @@ test_revert_deleted_subtree() {
 	(cd $testroot/wt && got revert -R . > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1046,8 +1046,8 @@ test_revert_deleted_subtree() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1100,8 +1100,8 @@ R  passwd.link
 R  zeta.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1116,8 +1116,8 @@ EOF
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1132,8 +1132,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1149,8 +1149,8 @@ EOF
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1159,8 +1159,8 @@ EOF
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1169,8 +1169,8 @@ EOF
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1184,8 +1184,8 @@ EOF
 	readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
 	echo ".got/foo" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1200,8 +1200,8 @@ EOF
 	readlink $testroot/wt/zeta.link > $testroot/stdout
 	echo "epsilon/zeta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1217,8 +1217,8 @@ EOF
 	echo "?  dotgotfoo.link" > $testroot/stdout.expected
 	echo "?  new.link" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -1265,8 +1265,8 @@ test_revert_patch_symlink() {
 	printf "y\nn\ny\nn\ny\ny\nn\ny\ny\n" > $testroot/patchscript
 	(cd $testroot/wt && got revert -F $testroot/patchscript -p -R . \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got revert command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1332,8 +1332,8 @@ revert this addition? [y/n] y
 R  zeta3.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1348,8 +1348,8 @@ EOF
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1364,8 +1364,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1381,8 +1381,8 @@ EOF
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1391,8 +1391,8 @@ EOF
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1401,8 +1401,8 @@ EOF
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1416,8 +1416,8 @@ EOF
 	readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
 	echo ".got/foo" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1439,8 +1439,8 @@ EOF
 	readlink $testroot/wt/zeta2.link > $testroot/stdout
 	echo "epsilon/zeta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1455,8 +1455,8 @@ EOF
 	readlink $testroot/wt/zeta3.link > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1475,8 +1475,8 @@ EOF
 	echo "D  zeta.link" >> $testroot/stdout.expected
 	echo "?  zeta3.link" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
blob - f82d2c0f4b893ae2e6c20f40ea0f892622559bec
blob + b48ce4011c7e953f442dffb07e92ceeb2fc2a62b
--- regress/cmdline/rm.sh
+++ regress/cmdline/rm.sh
@@ -20,8 +20,8 @@ test_rm_basic() {
 	local testroot=`test_init rm_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -31,8 +31,8 @@ test_rm_basic() {
 	(cd $testroot/wt && got rm alpha beta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -41,8 +41,8 @@ test_rm_basic() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -63,8 +63,8 @@ test_rm_with_local_mods() {
 	local testroot=`test_init rm_with_local_mods`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -75,8 +75,8 @@ test_rm_with_local_mods() {
 	(cd $testroot/wt && got rm beta 2>$testroot/stderr)
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -86,8 +86,8 @@ test_rm_with_local_mods() {
 	(cd $testroot/wt && got rm -f beta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 
@@ -104,8 +104,8 @@ test_double_rm() {
 	local testroot=`test_init double_rm`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -116,8 +116,8 @@ test_double_rm() {
 		echo -n > $testroot/stderr.expected
 		(cd $testroot/wt && got rm $fflag beta > $testroot/stdout \
 			2> $testroot/stderr)
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			echo "got rm command failed unexpectedly" >&2
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
@@ -125,8 +125,8 @@ test_double_rm() {
 		fi
 		echo -n > $testroot/stdout.expected
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -139,8 +139,8 @@ test_rm_and_add_elsewhere() {
 	local testroot=`test_init rm_and_add_elsewhere`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -152,16 +152,16 @@ test_rm_and_add_elsewhere() {
 	echo '!  alpha' > $testroot/stdout.expected
 	echo '?  epsilon/alpha' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rm alpha > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" == "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got rm command succeeded unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
@@ -170,8 +170,8 @@ test_rm_and_add_elsewhere() {
 
 	echo -n '' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -180,16 +180,16 @@ test_rm_and_add_elsewhere() {
 	echo "got: alpha: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rm -f alpha > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rm command failed unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
@@ -198,16 +198,16 @@ test_rm_and_add_elsewhere() {
 
 	echo 'D  alpha' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -216,8 +216,8 @@ test_rm_and_add_elsewhere() {
 	# While here, test behaviour of rm on files in unversioned status.
 	(cd $testroot/wt && got rm epsilon/alpha > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" == "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got rm command succeeded unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
@@ -226,8 +226,8 @@ test_rm_and_add_elsewhere() {
 
 	echo -n '' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -236,8 +236,8 @@ test_rm_and_add_elsewhere() {
 	echo "got: epsilon/alpha: file has unexpected status" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -246,8 +246,8 @@ test_rm_and_add_elsewhere() {
 	# And test the same case with -f.
 	(cd $testroot/wt && got rm -f epsilon/alpha > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" == "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got rm command succeeded unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
@@ -256,8 +256,8 @@ test_rm_and_add_elsewhere() {
 
 	echo -n '' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -266,8 +266,8 @@ test_rm_and_add_elsewhere() {
 	echo "got: epsilon/alpha: file has unexpected status" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -277,8 +277,8 @@ test_rm_and_add_elsewhere() {
 	(cd $testroot/wt && got add epsilon/alpha > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -289,8 +289,8 @@ test_rm_and_add_elsewhere() {
 	echo 'D  alpha' > $testroot/stdout.expected
 	echo 'A  epsilon/alpha' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -300,19 +300,19 @@ test_rm_directory() {
 	local testroot=`test_init rm_directory`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rm . > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
+	ret=$?
 	echo "got: removing directories requires -R option" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -320,8 +320,8 @@ test_rm_directory() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -335,8 +335,8 @@ test_rm_directory() {
 	echo 'D  gamma/delta' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -347,8 +347,8 @@ test_rm_directory() {
 	echo -n '' > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -359,8 +359,8 @@ test_rm_directory() {
 	echo -n '' > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -373,19 +373,19 @@ test_rm_directory_keep_files() {
 	local testroot=`test_init rm_directory_keep_files`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got rm . > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
+	ret=$?
 	echo "got: removing directories requires -R option" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -393,8 +393,8 @@ test_rm_directory_keep_files() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -408,8 +408,8 @@ test_rm_directory_keep_files() {
 	echo 'D  gamma/delta' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -423,8 +423,8 @@ test_rm_directory_keep_files() {
 	echo 'D  gamma/delta' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -439,8 +439,8 @@ test_rm_directory_keep_files() {
 	echo '?  gamma/delta' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -453,8 +453,8 @@ test_rm_subtree() {
 	local testroot=`test_init rm_subtree`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -500,8 +500,8 @@ test_rm_subtree() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -519,8 +519,8 @@ test_rm_symlink() {
 	git_commit $testroot/repo -m "add symlinks"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -534,8 +534,8 @@ test_rm_symlink() {
 		epsilon/beta.link nonexistent.link > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -545,8 +545,8 @@ test_rm_status_code() {
 	local testroot=`test_init rm_status_code`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -557,8 +557,8 @@ test_rm_status_code() {
 	(cd $testroot/wt && got rm -s Mx beta 2>$testroot/stderr)
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -570,8 +570,8 @@ test_rm_status_code() {
 	(cd $testroot/wt && got rm -R -s '!' . >$testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 
@@ -590,8 +590,8 @@ test_rm_status_code() {
 	(cd $testroot/wt && got rm -R -s 'M!' . >$testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "1"
 		return 1
@@ -607,8 +607,8 @@ test_rm_status_code() {
 	echo 'D  epsilon/zeta' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "1"
 		return 1
@@ -621,8 +621,8 @@ test_rm_nonexistent_directory() {
 	local testroot=`test_init rm_nonexistent_directory`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -631,8 +631,8 @@ test_rm_nonexistent_directory() {
 
 	(cd $testroot/wt && got rm epsilon > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" == "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got rm command succeeded unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "1"
@@ -641,8 +641,8 @@ test_rm_nonexistent_directory() {
 
 	echo -n '' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -651,8 +651,8 @@ test_rm_nonexistent_directory() {
 	echo "got: epsilon: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -660,8 +660,8 @@ test_rm_nonexistent_directory() {
 
 	(cd $testroot/wt && got rm -f epsilon > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rm command failed unexpectedly" >&2
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
@@ -670,8 +670,8 @@ test_rm_nonexistent_directory() {
 
 	echo -n '' > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -679,8 +679,8 @@ test_rm_nonexistent_directory() {
 
 	echo -n '' > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
blob - 3eb8e7e29c0385103d644e4f76b51d8f5f478922
blob + f96b6f089a1474bc624180cf278501ffb7f16af7
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -22,8 +22,8 @@ test_send_basic() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -48,8 +48,8 @@ EOF
 	local commit_id2=`git_show_head $testroot/repo`
 
 	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -57,15 +57,15 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -78,15 +78,15 @@ EOF
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -100,8 +100,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -112,16 +112,16 @@ EOF
 	got tree -r $testroot/repo -c $commit_id2 -i -R \
 		> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -130,15 +130,15 @@ EOF
 	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
 	echo "Already up-to-date" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -148,8 +148,8 @@ test_send_rebase_required() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -170,8 +170,8 @@ EOF
 	(cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
 
 	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -179,8 +179,8 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -189,15 +189,15 @@ EOF
 	echo "got: refs/heads/master: fetch and rebase required" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -207,8 +207,8 @@ test_send_rebase_required_overwrite() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -232,8 +232,8 @@ EOF
 	# non-default remote requires an explicit argument
 	got send -q -r $testroot/repo -f > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -241,8 +241,8 @@ EOF
 	echo "got: origin: remote repository not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -250,8 +250,8 @@ EOF
 
 	got send -q -r $testroot/repo -f foobar > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -259,15 +259,15 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -279,15 +279,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -305,15 +305,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -326,8 +326,8 @@ test_send_delete() {
 	got branch -r $testroot/repo branch1
 
 	got clone -a -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -343,7 +343,7 @@ EOF
 	got branch -r $testroot/repo-clone branch2
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -358,8 +358,8 @@ EOF
 	# time is not allowed.
 	got send -q -r $testroot/repo -d branch1 -b branch1 \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -368,8 +368,8 @@ EOF
 		> $testroot/stderr.expected
 	echo ": reference cannot be deleted" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -377,8 +377,8 @@ EOF
 
 	got send -q -r $testroot/repo -d refs/heads/branch1 origin \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -386,8 +386,8 @@ EOF
 
 	got send -r $testroot/repo -d refs/heads/branch2 origin \
 		> $testroot/stdout 2>$testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -398,8 +398,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -408,8 +408,8 @@ EOF
 	# branchX exists in neither repository
 	got send -q -r $testroot/repo -d refs/heads/branchX origin \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -419,8 +419,8 @@ EOF
 	echo "repository: no such reference found" >> $testroot/stderr.expected
 	echo "got: no such reference found" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -429,8 +429,8 @@ EOF
 	# References outside of refs/heads/ cannot be deleted with 'got send'.
 	got send -q -r $testroot/repo -d refs/tags/1.0 origin \
 		> $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -441,15 +441,15 @@ EOF
 		>> $testroot/stderr.expected
 	echo "got: no such reference found" >> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -460,15 +460,15 @@ EOF
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -484,15 +484,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -504,8 +504,8 @@ test_send_clone_and_send() {
 	(cd $testroot/repo && git config receive.denyCurrentBranch ignore)
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -517,8 +517,8 @@ test_send_clone_and_send() {
 	local commit_id2=`git_show_head $testroot/repo-clone`
 
 	(cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -526,15 +526,15 @@ test_send_clone_and_send() {
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -544,15 +544,15 @@ test_send_clone_and_send() {
 	echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -570,15 +570,15 @@ test_send_clone_and_send() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -588,8 +588,8 @@ test_send_tags() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -614,8 +614,8 @@ EOF
 		| tr -d ' ' | cut -d: -f2`
 
 	got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -623,15 +623,15 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -645,15 +645,15 @@ EOF
 	echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -669,8 +669,8 @@ EOF
 	echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -680,8 +680,8 @@ EOF
 	echo "tag 1.0 $tag_id" > $testroot/stdout.expected
 	echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -689,8 +689,8 @@ EOF
 
 	# Send the same tags again. This should be a no-op.
 	got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -698,8 +698,8 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -713,8 +713,8 @@ EOF
 
 	got send -q -r $testroot/repo -t 1.0 > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -723,8 +723,8 @@ EOF
 	echo "got: refs/tags/1.0: tag already exists on server" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -733,8 +733,8 @@ EOF
 	# attempting the same with -T should fail, too
 	got send -q -r $testroot/repo -T > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -743,8 +743,8 @@ EOF
 	echo "got: refs/tags/1.0: tag already exists on server" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -754,8 +754,8 @@ EOF
 	echo "tag 1.0 $tag_id" > $testroot/stdout.expected
 	echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -764,8 +764,8 @@ EOF
 	# overwrite the 1.0 tag only
 	got send -q -r $testroot/repo -t 1.0 -f > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -775,8 +775,8 @@ EOF
 	echo "tag 1.0 $tag_id3" > $testroot/stdout.expected
 	echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -789,8 +789,8 @@ EOF
 	# Send the new commit in isolation.
 	got send -q -r $testroot/repo > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -804,8 +804,8 @@ EOF
 
 	got send -r $testroot/repo -t 3.0 > $testroot/stdout.raw \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -820,7 +820,7 @@ EOF
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -830,8 +830,8 @@ test_send_tag_of_deleted_branch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -867,8 +867,8 @@ EOF
 	local commit_id3=`git_show_head $testroot/repo`
 
 	got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -876,15 +876,15 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -901,15 +901,15 @@ EOF
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -924,8 +924,8 @@ EOF
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -935,15 +935,15 @@ EOF
 	echo "tag 1.0 $tag_id" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -955,8 +955,8 @@ test_send_new_branch() {
 	(cd $testroot/repo && git config receive.denyCurrentBranch ignore)
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -969,8 +969,8 @@ test_send_new_branch() {
 	local commit_id2=`git_show_branch_head $testroot/repo-clone foo`
 
 	(cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -978,15 +978,15 @@ test_send_new_branch() {
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -997,15 +997,15 @@ test_send_new_branch() {
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1026,15 +1026,15 @@ test_send_new_branch() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -1046,8 +1046,8 @@ test_send_all_branches() {
 	(cd $testroot/repo && git config receive.denyCurrentBranch ignore)
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1071,7 +1071,7 @@ test_send_all_branches() {
 	local commit_id4=`git_show_branch_head $testroot/repo-clone bar`
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1084,8 +1084,8 @@ test_send_all_branches() {
 
 	got send -a -q -r $testroot/repo-clone -b master > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1093,8 +1093,8 @@ test_send_all_branches() {
 	echo "got: -a and -b options are mutually exclusive" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1102,8 +1102,8 @@ test_send_all_branches() {
 
 	got send -a -q -r $testroot/repo-clone > $testroot/stdout \
 		2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1111,15 +1111,15 @@ test_send_all_branches() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1131,15 +1131,15 @@ test_send_all_branches() {
 	echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1163,15 +1163,15 @@ test_send_all_branches() {
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -1182,8 +1182,8 @@ test_send_to_empty_repo() {
 
 	got init $testroot/repo2
 
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1200,8 +1200,8 @@ EOF
 	local commit_id2=`git_show_head $testroot/repo`
 
 	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1209,8 +1209,8 @@ EOF
 	
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1220,7 +1220,7 @@ EOF
 	got ref -r $testroot/repo2 -s refs/heads/master HEAD
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1232,15 +1232,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo2 > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1250,16 +1250,16 @@ EOF
 	echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1268,15 +1268,15 @@ EOF
 	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
 	echo "Already up-to-date" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo2"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -1286,8 +1286,8 @@ test_send_and_fetch_config() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1315,7 +1315,7 @@ remote "origin" {
 }
 EOF
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1325,8 +1325,8 @@ EOF
 	echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1334,15 +1334,15 @@ EOF
 
 	# fetch tag 2.0 from repo-clone2
 	got fetch -q -r $testroot/repo > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got fetch command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1357,8 +1357,8 @@ EOF
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 	echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1366,15 +1366,15 @@ EOF
 
 	# send tag 1.0 to repo-clone
 	got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1389,15 +1389,15 @@ EOF
 	echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
@@ -1407,8 +1407,8 @@ test_send_config() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got clone -q $testurl/repo $testroot/repo-clone
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got clone command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1423,7 +1423,7 @@ remote "origin" {
 }
 EOF
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1437,8 +1437,8 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1447,15 +1447,15 @@ EOF
 	got branch -r $testroot/repo foo
 
 	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got ref -l -r $testroot/repo-clone > $testroot/stdout
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1470,15 +1470,15 @@ EOF
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	git_fsck "$testroot" "$testroot/repo-clone"
-	ret="$?"
+	ret=$?
 	test_done "$testroot" "$ret"
 }
 
blob - 2f126fac8cca3afed8a2b489b7d7e3223c308752
blob + e16d9854340821bff1be14c3086fbe1a59b26843
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
@@ -23,8 +23,8 @@ test_stage_basic() {
 	local testroot=`test_init stage_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -40,8 +40,8 @@ test_stage_basic() {
 	(cd $testroot/wt && got stage > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -51,16 +51,16 @@ test_stage_no_changes() {
 	local testroot=`test_init stage_no_changes`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got stage alpha beta > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -69,8 +69,8 @@ test_stage_no_changes() {
 	echo "got: no changes to stage" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -78,8 +78,8 @@ test_stage_no_changes() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -89,8 +89,8 @@ test_stage_unversioned() {
 	local testroot=`test_init stage_unversioned`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -102,16 +102,16 @@ test_stage_unversioned() {
 	echo "M  alpha" > $testroot/stdout.expected
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got stage > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -119,8 +119,8 @@ test_stage_unversioned() {
 
 	echo " M alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -130,8 +130,8 @@ test_stage_unversioned() {
 
 	(cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -139,8 +139,8 @@ test_stage_unversioned() {
 
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -151,8 +151,8 @@ test_stage_nonexistent() {
 	local testroot=`test_init stage_nonexistent`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -162,8 +162,8 @@ test_stage_nonexistent() {
 	echo "got: nonexistent-file: No such file or directory" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -173,8 +173,8 @@ test_stage_list() {
 	local testroot=`test_init stage_list`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -200,8 +200,8 @@ test_stage_list() {
 		cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
 	echo " A foo" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -212,8 +212,8 @@ test_stage_list() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -225,8 +225,8 @@ test_stage_list() {
 		cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
 	echo " M alpha" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -238,8 +238,8 @@ test_stage_conflict() {
 	local initial_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -260,8 +260,8 @@ test_stage_conflict() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -269,8 +269,8 @@ test_stage_conflict() {
 
 	(cd $testroot/wt && got stage alpha > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -281,15 +281,15 @@ test_stage_conflict() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -300,8 +300,8 @@ test_stage_out_of_date() {
 	local initial_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -314,8 +314,8 @@ test_stage_out_of_date() {
 	echo "modified alpha again" > $testroot/wt/alpha
 	(cd $testroot/wt && got stage alpha > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -326,15 +326,15 @@ test_stage_out_of_date() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -345,8 +345,8 @@ test_double_stage() {
 	local testroot=`test_init double_stage`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -359,8 +359,8 @@ test_double_stage() {
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	(cd $testroot/wt && got stage alpha 2> $testroot/stderr)
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -368,16 +368,16 @@ test_double_stage() {
 
 	(cd $testroot/wt && got stage beta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -386,8 +386,8 @@ test_double_stage() {
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	(cd $testroot/wt && got stage foo 2> $testroot/stderr)
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -396,16 +396,16 @@ test_double_stage() {
 	printf "q\n" > $testroot/patchscript
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -414,8 +414,8 @@ test_double_stage() {
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	(cd $testroot/wt && got stage foo 2> $testroot/stderr)
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -428,8 +428,8 @@ test_double_stage() {
 	echo ' A foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -441,8 +441,8 @@ test_double_stage() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -452,8 +452,8 @@ test_stage_status() {
 	local testroot=`test_init stage_status`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -477,8 +477,8 @@ test_stage_status() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -496,8 +496,8 @@ test_stage_status() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -508,8 +508,8 @@ test_stage_status() {
 	echo ' A foo' > $testroot/stdout.expected
 	(cd $testroot/wt && got status foo > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -520,8 +520,8 @@ test_stage_status() {
 	echo ' D beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status beta > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -532,8 +532,8 @@ test_stage_add_already_staged_file() {
 	local testroot=`test_init stage_add_already_staged_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -552,15 +552,15 @@ test_stage_add_already_staged_file() {
 		echo "got: $f: file has unexpected status" \
 			> $testroot/stderr.expected
 		cmp -s $testroot/stderr.expected $testroot/stderr
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
 			return 1
 		fi
 		cmp -s $testroot/stdout.expected $testroot/stdout
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stdout.expected $testroot/stdout
 			test_done "$testroot" "$ret"
 			return 1
@@ -573,8 +573,8 @@ test_stage_add_already_staged_file() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -584,8 +584,8 @@ test_stage_rm_already_staged_file() {
 	local testroot=`test_init stage_rm_already_staged_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -599,24 +599,24 @@ test_stage_rm_already_staged_file() {
 
 	(cd $testroot/wt && got rm beta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got rm command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -626,15 +626,15 @@ test_stage_rm_already_staged_file() {
 		echo "got: $f: file is staged" > $testroot/stderr.expected
 		(cd $testroot/wt && got rm $f \
 			> $testroot/stdout 2> $testroot/stderr)
-		ret="$?"
-		if [ "$ret" = "0" ]; then
+		ret=$?
+		if [ $ret -eq 0 ]; then
 			echo "got rm command succeeded unexpectedly" >&2
 			test_done "$testroot" "1"
 			return 1
 		fi
 		cmp -s $testroot/stderr.expected $testroot/stderr
-		ret="$?"
-		if [ "$ret" != "0" ]; then
+		ret=$?
+		if [ $ret -ne 0 ]; then
 			diff -u $testroot/stderr.expected $testroot/stderr
 			test_done "$testroot" "$ret"
 			return 1
@@ -647,8 +647,8 @@ test_stage_rm_already_staged_file() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -658,8 +658,8 @@ test_stage_revert() {
 	local testroot=`test_init stage_revert`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -674,8 +674,8 @@ test_stage_revert() {
 	echo "modified added file again" >> $testroot/wt/foo
 
 	(cd $testroot/wt && got revert alpha > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -683,8 +683,8 @@ test_stage_revert() {
 
 	echo "R  alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -693,8 +693,8 @@ test_stage_revert() {
 	echo "modified alpha" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -705,16 +705,16 @@ test_stage_revert() {
 	echo 'MA foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got revert alpha > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -722,8 +722,8 @@ test_stage_revert() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -732,8 +732,8 @@ test_stage_revert() {
 	echo "modified alpha" > $testroot/content.expected
 	cat $testroot/wt/alpha > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -741,8 +741,8 @@ test_stage_revert() {
 
 	(cd $testroot/wt && got revert beta > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -750,8 +750,8 @@ test_stage_revert() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -759,16 +759,16 @@ test_stage_revert() {
 
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got revert foo > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -776,8 +776,8 @@ test_stage_revert() {
 
 	echo "R  foo" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -786,8 +786,8 @@ test_stage_revert() {
 	echo "new file" > $testroot/content.expected
 	cat $testroot/wt/foo > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -798,16 +798,16 @@ test_stage_revert() {
 	echo ' A foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got revert foo > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -815,8 +815,8 @@ test_stage_revert() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -825,8 +825,8 @@ test_stage_revert() {
 	echo "new file" > $testroot/content.expected
 	cat $testroot/wt/foo > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -837,8 +837,8 @@ test_stage_revert() {
 	echo ' A foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -849,8 +849,8 @@ test_stage_revert() {
 
 	(cd $testroot/wt && got revert -R . > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "revert command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -859,8 +859,8 @@ test_stage_revert() {
 	echo "R  alpha" > $testroot/stdout.expected
 	echo "R  foo" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -868,8 +868,8 @@ test_stage_revert() {
 
 	echo -n > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -880,8 +880,8 @@ test_stage_revert() {
 	echo ' A foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -892,8 +892,8 @@ test_stage_diff() {
 	local head_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -906,8 +906,8 @@ test_stage_diff() {
 	(cd $testroot/wt && got diff -s > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -921,8 +921,8 @@ test_stage_diff() {
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -956,8 +956,8 @@ test_stage_diff() {
 	echo '+new file changed' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -996,8 +996,8 @@ test_stage_diff() {
 	echo '+new file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1009,8 +1009,8 @@ test_stage_histedit() {
 	local orig_commit=`git_show_head $testroot/repo`
 
 	got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1034,8 +1034,8 @@ test_stage_histedit() {
 
 	(cd $testroot/wt && got histedit -F $testroot/histedit-script \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got histedit command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1045,15 +1045,15 @@ test_stage_histedit() {
 	echo "got: alpha: file is staged" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1082,8 +1082,8 @@ test_stage_rebase() {
 	local master_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1093,8 +1093,8 @@ test_stage_rebase() {
 
 	(cd $testroot/wt && got rebase newbranch \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got rebase command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1104,15 +1104,15 @@ test_stage_rebase() {
 	echo "got: alpha: file is staged" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1122,8 +1122,8 @@ test_stage_update() {
 	local testroot=`test_init stage_update`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1136,8 +1136,8 @@ test_stage_update() {
 
 	(cd $testroot/wt && got update > $testroot/stdout  \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got update command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1147,15 +1147,15 @@ test_stage_update() {
 	echo "got: alpha: file is staged" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1165,8 +1165,8 @@ test_stage_commit_non_staged() {
 	local testroot=`test_init stage_commit_non_staged`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1180,8 +1180,8 @@ test_stage_commit_non_staged() {
 	echo "modified file" > $testroot/wt/gamma/delta
 	(cd $testroot/wt && got commit -m "change delta" gamma/delta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got commit command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1191,15 +1191,15 @@ test_stage_commit_non_staged() {
 	echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1209,8 +1209,8 @@ test_stage_commit_out_of_date() {
 	local testroot=`test_init stage_commit_out_of_date`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1226,8 +1226,8 @@ test_stage_commit_out_of_date() {
 
 	(cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got commit command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1239,15 +1239,15 @@ test_stage_commit_out_of_date() {
 	echo "can be committed" >> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1259,15 +1259,15 @@ test_stage_commit_out_of_date() {
 	echo "got: alpha: file is staged" > $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1275,8 +1275,8 @@ test_stage_commit_out_of_date() {
 
 	(cd $testroot/wt && got unstage > /dev/null)
 	(cd $testroot/wt && got update > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got update command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1287,8 +1287,8 @@ test_stage_commit_out_of_date() {
 	echo "D  beta" >> $testroot/stdout.expected
 	echo "A  foo" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1300,8 +1300,8 @@ test_stage_commit_out_of_date() {
 	(cd $testroot/wt && got stage > /dev/null)
 
 	(cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1313,8 +1313,8 @@ test_stage_commit_out_of_date() {
 	echo "D  beta" >> $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1326,8 +1326,8 @@ test_stage_commit() {
 	local first_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1353,8 +1353,8 @@ test_stage_commit() {
 
 	(cd $testroot/wt && got commit -m "staged changes" \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1367,8 +1367,8 @@ test_stage_commit() {
 	echo "Created commit $head_commit" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1410,8 +1410,8 @@ test_stage_commit() {
 	echo '+new file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1425,8 +1425,8 @@ test_stage_commit() {
 
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1441,8 +1441,8 @@ test_stage_patch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1455,8 +1455,8 @@ test_stage_patch() {
 	printf "n\nn\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p \
 		numbers > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1498,8 +1498,8 @@ M  numbers (change 3 of 3)
 stage this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1507,8 +1507,8 @@ EOF
 
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1518,8 +1518,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1567,8 +1567,8 @@ M  numbers (change 3 of 3)
 stage this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1577,8 +1577,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1607,16 +1607,16 @@ EOF
 	echo " 9" >> $testroot/stdout.expected
 	echo " 10" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got unstage >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1624,8 +1624,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1673,8 +1673,8 @@ M  numbers (change 3 of 3)
 stage this change? [y/n/q] y
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1683,8 +1683,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1710,8 +1710,8 @@ EOF
 	echo "-16" >> $testroot/stdout.expected
 	echo "+c" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1726,8 +1726,8 @@ test_stage_patch_twice() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1778,8 +1778,8 @@ M  numbers (change 3 of 3)
 stage this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1788,8 +1788,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1824,8 +1824,8 @@ M  numbers (change 2 of 2)
 stage this change? [y/n/q] y
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1834,8 +1834,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1872,8 +1872,8 @@ EOF
 +c
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1899,8 +1899,8 @@ EOF
  5
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1911,8 +1911,8 @@ test_stage_patch_added() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1927,8 +1927,8 @@ test_stage_patch_added() {
 	echo "A  epsilon/new" > $testroot/stdout.expected
 	echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1937,8 +1937,8 @@ test_stage_patch_added() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " A epsilon/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1957,8 +1957,8 @@ test_stage_patch_added() {
 	echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
 	echo "+new" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1969,8 +1969,8 @@ test_stage_patch_added_twice() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1985,8 +1985,8 @@ test_stage_patch_added_twice() {
 	echo "A  epsilon/new" > $testroot/stdout.expected
 	echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1995,8 +1995,8 @@ test_stage_patch_added_twice() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " A epsilon/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2004,8 +2004,8 @@ test_stage_patch_added_twice() {
 
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p \
 		epsilon/new > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2013,8 +2013,8 @@ test_stage_patch_added_twice() {
 
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -2022,8 +2022,8 @@ test_stage_patch_added_twice() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -2034,8 +2034,8 @@ test_stage_patch_removed() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2051,8 +2051,8 @@ test_stage_patch_removed() {
 	echo "D  beta" > $testroot/stdout.expected
 	echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2061,8 +2061,8 @@ test_stage_patch_removed() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " D beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2081,8 +2081,8 @@ test_stage_patch_removed() {
 	echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
 	echo "-beta" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -2093,8 +2093,8 @@ test_stage_patch_removed_twice() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2110,8 +2110,8 @@ test_stage_patch_removed_twice() {
 	echo "D  beta" > $testroot/stdout.expected
 	echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2120,8 +2120,8 @@ test_stage_patch_removed_twice() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " D beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2129,8 +2129,8 @@ test_stage_patch_removed_twice() {
 
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -2138,8 +2138,8 @@ test_stage_patch_removed_twice() {
 
 	echo "got: no changes to stage" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -2147,8 +2147,8 @@ test_stage_patch_removed_twice() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -2164,8 +2164,8 @@ test_stage_patch_quit() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2180,8 +2180,8 @@ test_stage_patch_quit() {
 	printf "y\nq\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2215,8 +2215,8 @@ D  zzz
 stage this deletion? [y/n] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2226,8 +2226,8 @@ EOF
 	echo "MM numbers" > $testroot/stdout.expected
 	echo "D  zzz" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2254,8 +2254,8 @@ EOF
 	echo " 4" >> $testroot/stdout.expected
 	echo " 5" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -2272,8 +2272,8 @@ test_stage_patch_incomplete_script() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2286,8 +2286,8 @@ test_stage_patch_incomplete_script() {
 	printf "y\n" > $testroot/patchscript
 	(cd $testroot/wt && got stage -F $testroot/patchscript -p \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2320,16 +2320,16 @@ EOF
 	echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
 	echo "got: invalid patch choice" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2338,8 +2338,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2348,8 +2348,8 @@ EOF
 	(cd $testroot/wt && got diff -s > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -2369,8 +2369,8 @@ test_stage_symlink() {
 	local head_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2387,8 +2387,8 @@ test_stage_symlink() {
 	(cd $testroot/wt && got add zeta.link > /dev/null)
 
 	(cd $testroot/wt && got stage > $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "got stage succeeded unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -2397,8 +2397,8 @@ test_stage_symlink() {
 	echo "symbolic link points outside of paths under version control" \
 		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -2416,8 +2416,8 @@ test_stage_symlink() {
  A zeta.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2506,8 +2506,8 @@ EOF
 	echo '\ No newline at end of file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2515,8 +2515,8 @@ EOF
 
 	(cd $testroot/wt && got commit -m "staged symlink" \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2532,16 +2532,16 @@ EOF
 	echo "D  nonexistent.link" >> $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got tree -r $testroot/repo -c $commit_id > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got tree command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2560,8 +2560,8 @@ passwd.link@ -> /etc/passwd
 zeta.link@ -> gamma/delta
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -2575,8 +2575,8 @@ EOF
 	echo 'this is regular file alpha.link' > $testroot/content.expected
 	cp $testroot/wt/alpha.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2596,8 +2596,8 @@ EOF
 	echo -n ".got/bar" > $testroot/content.expected
 	cp $testroot/wt/dotgotbar.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2611,8 +2611,8 @@ EOF
 	echo "this is regular file foo" > $testroot/content.expected
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2627,8 +2627,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2642,8 +2642,8 @@ EOF
 	echo -n "/etc/passwd" > $testroot/content.expected
 	cp $testroot/wt/passwd.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2658,8 +2658,8 @@ EOF
 	readlink $testroot/wt/zeta.link > $testroot/stdout
 	echo "gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2681,8 +2681,8 @@ test_stage_patch_symlink() {
 	local head_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2740,8 +2740,8 @@ A  zeta.link
 stage this addition? [y/n] y
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2808,8 +2808,8 @@ EOF
 	echo '\ No newline at end of file' >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2817,8 +2817,8 @@ EOF
 
 	(cd $testroot/wt && got commit -m "staged symlink" \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got commit command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2832,16 +2832,16 @@ EOF
 	echo "D  nonexistent.link" >> $testroot/stdout.expected
 	echo "Created commit $commit_id" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	got tree -r $testroot/repo -c $commit_id > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got tree command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2859,8 +2859,8 @@ passwd.link@ -> /etc/passwd
 zeta.link@ -> gamma/delta
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
@@ -2874,8 +2874,8 @@ EOF
 	echo 'this is regular file alpha.link' > $testroot/content.expected
 	cp $testroot/wt/alpha.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2889,8 +2889,8 @@ EOF
 	readlink $testroot/wt/dotgotbar.link > $testroot/stdout
 	echo ".got/bar" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2904,8 +2904,8 @@ EOF
 	echo "this is regular file foo" > $testroot/content.expected
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2920,8 +2920,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2935,8 +2935,8 @@ EOF
 	echo -n "/etc/passwd" > $testroot/content.expected
 	cp $testroot/wt/passwd.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2951,8 +2951,8 @@ EOF
 	readlink $testroot/wt/zeta.link > $testroot/stdout
 	echo "gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
blob - f96cb55c8433319268b0b22d1615907b94f37ce7
blob + 4639246145d93e24cbf89dd139a7c9891de5c9be
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -20,8 +20,8 @@ test_status_basic() {
 	local testroot=`test_init status_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -44,8 +44,8 @@ test_status_basic() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	chmod 700 $testroot/wt/bar
@@ -65,8 +65,8 @@ test_status_subdir_no_mods() {
 	git_commit $testroot/repo -m "add subdir with files"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -80,8 +80,8 @@ test_status_subdir_no_mods() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -105,8 +105,8 @@ test_status_subdir_no_mods2() {
 	git_commit $testroot/repo -m "add subdir with files"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -124,8 +124,8 @@ test_status_subdir_no_mods2() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -135,8 +135,8 @@ test_status_obstructed() {
 	local testroot=`test_init status_obstructed`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -149,8 +149,8 @@ test_status_obstructed() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -159,8 +159,8 @@ test_status_obstructed() {
 	(cd $testroot/wt && got status epsilon/zeta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -181,8 +181,8 @@ test_status_shows_local_mods_after_update() {
 	git_commit $testroot/repo -m "added numbers file"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -201,8 +201,8 @@ test_status_shows_local_mods_after_update() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -213,8 +213,8 @@ test_status_shows_local_mods_after_update() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -239,8 +239,8 @@ test_status_unversioned_subdirs() {
 	git_commit $testroot/repo -m "first commit"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -261,8 +261,8 @@ test_status_unversioned_subdirs() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -280,8 +280,8 @@ test_status_symlink() {
 	git_commit $testroot/repo -m "first commit"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -293,8 +293,8 @@ test_status_symlink() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -319,8 +319,8 @@ test_status_symlink() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -339,8 +339,8 @@ test_status_shows_no_mods_after_complete_merge() {
 	git_commit $testroot/repo -m "added numbers file"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -360,8 +360,8 @@ test_status_shows_no_mods_after_complete_merge() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -372,8 +372,8 @@ test_status_shows_no_mods_after_complete_merge() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -394,8 +394,8 @@ test_status_shows_conflict() {
 	git_commit $testroot/repo -m "added numbers file"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -415,8 +415,8 @@ test_status_shows_conflict() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -427,8 +427,8 @@ test_status_shows_conflict() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -438,8 +438,8 @@ test_status_empty_dir() {
 	local testroot=`test_init status_empty_dir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -451,8 +451,8 @@ test_status_empty_dir() {
 	(cd $testroot/wt && got status epsilon > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -462,8 +462,8 @@ test_status_empty_dir_unversioned_file() {
 	local testroot=`test_init status_empty_dir_unversioned_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -477,8 +477,8 @@ test_status_empty_dir_unversioned_file() {
 	(cd $testroot/wt && got status epsilon > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -488,8 +488,8 @@ test_status_many_paths() {
 	local testroot=`test_init status_many_paths`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -515,8 +515,8 @@ test_status_many_paths() {
 		> $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -526,8 +526,8 @@ test_status_cvsignore() {
 	local testroot=`test_init status_cvsignore`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -552,8 +552,8 @@ test_status_cvsignore() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -564,8 +564,8 @@ test_status_cvsignore() {
 	(cd $testroot/wt && got status epsilon > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -575,8 +575,8 @@ test_status_cvsignore() {
 	(cd $testroot/wt && got status epsilon/new > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -589,8 +589,8 @@ test_status_cvsignore() {
 	(cd $testroot/wt/gamma && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -608,16 +608,16 @@ test_status_cvsignore() {
 ?  foop
 EOF
 	(cd $testroot/wt && got status -I > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got status failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -627,8 +627,8 @@ test_status_gitignore() {
 	local testroot=`test_init status_gitignore`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -653,8 +653,8 @@ test_status_gitignore() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -665,8 +665,8 @@ test_status_gitignore() {
 	(cd $testroot/wt/gamma && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -684,16 +684,16 @@ test_status_gitignore() {
 ?  foop
 EOF
 	(cd $testroot/wt && got status -I > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got status failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -703,8 +703,8 @@ test_status_status_code() {
 	local testroot=`test_init status_status_code`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -719,8 +719,8 @@ test_status_status_code() {
 
 	(cd $testroot/wt && got status -s xDM \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "status succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -728,8 +728,8 @@ test_status_status_code() {
 
 	echo "got: invalid status code 'x'" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -738,8 +738,8 @@ test_status_status_code() {
 	echo 'M  alpha' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -s M > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -748,8 +748,8 @@ test_status_status_code() {
 	echo 'D  beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -s D > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -759,8 +759,8 @@ test_status_status_code() {
 	echo '?  foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status -s !\? > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -769,8 +769,8 @@ test_status_status_code() {
 	echo 'A  new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -s A > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -781,8 +781,8 @@ test_status_status_code() {
 	echo ' A new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -s A > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -793,8 +793,8 @@ test_status_status_code() {
 	echo 'MA new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -s A > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -804,8 +804,8 @@ test_status_status_code() {
 	echo 'MA new' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status -s M > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -818,8 +818,8 @@ test_status_suppress() {
 	local testroot=`test_init status_suppress`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -834,8 +834,8 @@ test_status_suppress() {
 
 	(cd $testroot/wt && got status -S A -s M \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "status succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -844,8 +844,8 @@ test_status_suppress() {
 	echo "got: -s and -S options are mutually exclusive" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -853,8 +853,8 @@ test_status_suppress() {
 
 	(cd $testroot/wt && got status -s A -S M \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "status succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -863,8 +863,8 @@ test_status_suppress() {
 	echo "got: -S and -s options are mutually exclusive" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -872,8 +872,8 @@ test_status_suppress() {
 
 	(cd $testroot/wt && got status -S xDM \
 		> $testroot/stdout 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "status succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -881,8 +881,8 @@ test_status_suppress() {
 
 	echo "got: invalid status code 'x'" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -891,8 +891,8 @@ test_status_suppress() {
 	echo 'M  alpha' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -S D\?A! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -901,8 +901,8 @@ test_status_suppress() {
 	echo 'D  beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -S M\?A! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -912,8 +912,8 @@ test_status_suppress() {
 	echo '?  foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status -S MDA > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -922,8 +922,8 @@ test_status_suppress() {
 	echo 'A  new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -934,8 +934,8 @@ test_status_suppress() {
 	echo ' A new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -947,8 +947,8 @@ test_status_suppress() {
 	echo 'MA new' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status -S D\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -957,8 +957,8 @@ test_status_suppress() {
 	echo 'M  alpha' > $testroot/stdout.expected
 	(cd $testroot/wt && got status -S AD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -969,8 +969,8 @@ test_status_suppress() {
 
 	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -983,8 +983,8 @@ test_status_empty_file() {
 	local testroot=`test_init status_empty_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -997,8 +997,8 @@ test_status_empty_file() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1010,8 +1010,8 @@ test_status_empty_file() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1026,8 +1026,8 @@ test_status_empty_file() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 6e76b311f1077b2317955711690448d4be3efebc
blob + ab908a49f4d848281c7d725df6742a474700a0e1
--- regress/cmdline/tag.sh
+++ regress/cmdline/tag.sh
@@ -24,8 +24,8 @@ test_tag_create() {
 
 	# Create a tag based on repository's HEAD reference
 	got tag -m 'test' -r $testroot/repo -c HEAD $tag > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got ref command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -35,8 +35,8 @@ test_tag_create() {
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 	echo "Created tag $tag_id" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -44,8 +44,8 @@ test_tag_create() {
 
 	# Ensure that Git recognizes the tag Got has created
 	(cd $testroot/repo && git checkout -q $tag)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -53,8 +53,8 @@ test_tag_create() {
 
 	# Ensure Got recognizes the new tag
 	got checkout -c $tag $testroot/repo $testroot/wt >/dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -62,8 +62,8 @@ test_tag_create() {
 
 	# Create a tag based on implied worktree HEAD ref
 	(cd $testroot/wt && got tag -m 'test' $tag2 > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -72,16 +72,16 @@ test_tag_create() {
 		| grep "^refs/tags/$tag2" | tr -d ' ' | cut -d: -f2`
 	echo "Created tag $tag_id2" > $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/repo && git checkout -q $tag2)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "git checkout command failed unexpectedly"
 		test_done "$testroot" "$ret"
 		return 1
@@ -91,8 +91,8 @@ test_tag_create() {
 	local tree_id=`git_show_tree $testroot/repo`
 	(cd $testroot/wt && got tag -m 'test' -c $tree_id foobar \
 		2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "git tag command succeeded unexpectedly"
 		test_done "$testroot" "1"
 		return 1
@@ -101,8 +101,8 @@ test_tag_create() {
 	echo "got: commit $tree_id: object not found" \
 		> $testroot/stderr.expected
 	cmp -s $testroot/stderr $testroot/stderr.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -117,8 +117,8 @@ test_tag_create() {
 	echo "refs/tags/$tag: $tag_id" >> $testroot/stdout.expected
 	echo "refs/tags/$tag2: $tag_id2" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -165,8 +165,8 @@ test_tag_list() {
 	echo " test" >> $testroot/stdout.expected
 	echo " " >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -212,8 +212,8 @@ test_tag_list_lightweight() {
 	echo " adding the test tree" >> $testroot/stdout.expected
 	echo " " >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
blob - 9ca64b4d00d541ee2703cb9c58c93091e0ae020b
blob + 75ae4d9639f4152935424d22a9cd67bb41ebacf1
--- regress/cmdline/tree.sh
+++ regress/cmdline/tree.sh
@@ -35,8 +35,8 @@ test_tree_basic() {
 	(cd $testroot/wt && got tree > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 
@@ -47,8 +47,8 @@ test_tree_branch() {
 	local testroot=`test_init tree_branch`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -69,8 +69,8 @@ test_tree_branch() {
 	(cd $testroot/wt && got tree > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 
@@ -90,8 +90,8 @@ test_tree_submodule() {
 
 	# Currently fails in open(2)
 	got tree -r $testroot/repo repo2 > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "tree command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -100,8 +100,8 @@ test_tree_submodule() {
 		> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		return 1
 	fi
@@ -117,8 +117,8 @@ test_tree_submodule_of_same_repo() {
 
 	# Currently fails with "bad object data"
 	got tree -r $testroot/repo repo2 > $testroot/stdout 2> $testroot/stderr
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "tree command succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -133,8 +133,8 @@ test_tree_submodule_of_same_repo() {
 	echo "got: bad object data" >> $testroot/stderr.expected
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		return 1
 	fi
blob - 053325225ecc1c55962ba876ee2610f161762fa3
blob + d3635a2490f28f8544c57bf9a75a797727642b1f
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
@@ -20,8 +20,8 @@ test_unstage_basic() {
 	local testroot=`test_init unstage_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -37,8 +37,8 @@ test_unstage_basic() {
 	(cd $testroot/wt && got stage alpha beta foo > /dev/null)
 
 	(cd $testroot/wt && got unstage > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -48,8 +48,8 @@ test_unstage_basic() {
 	echo 'D  beta' >> $testroot/stdout.expected
 	echo 'G  foo' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -60,8 +60,8 @@ test_unstage_basic() {
 	echo 'A  foo' >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -71,8 +71,8 @@ test_unstage_unversioned() {
 	local testroot=`test_init unstage_unversioned`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -95,16 +95,16 @@ test_unstage_unversioned() {
 	echo ' A foo' >> $testroot/stdout.expected
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got unstage > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -114,8 +114,8 @@ test_unstage_unversioned() {
 	echo 'D  beta' >> $testroot/stdout.expected
 	echo 'G  foo' >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -125,8 +125,8 @@ test_unstage_unversioned() {
 
 	# unstaging an unversioned path is a no-op
 	(cd $testroot/wt && got unstage unversioned > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -138,8 +138,8 @@ test_unstage_unversioned() {
 	echo "?  unversioned-file" >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -149,8 +149,8 @@ test_unstage_nonexistent() {
 	local testroot=`test_init unstage_nonexistent`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -167,8 +167,8 @@ test_unstage_nonexistent() {
 
 	# unstaging a non-existent file is a no-op
 	(cd $testroot/wt && got unstage nonexistent-file > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -176,8 +176,8 @@ test_unstage_nonexistent() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -192,8 +192,8 @@ test_unstage_patch() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -203,8 +203,8 @@ test_unstage_patch() {
 	sed -i -e 's/^16$/c/' $testroot/wt/numbers
 
 	(cd $testroot/wt && got stage > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -214,8 +214,8 @@ test_unstage_patch() {
 	printf "n\nn\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got unstage -F $testroot/patchscript -p \
 		numbers > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -257,8 +257,8 @@ M  numbers (change 3 of 3)
 unstage this change? [y/n/q] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -267,8 +267,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " M numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -317,8 +317,8 @@ unstage this change? [y/n/q] n
 G  numbers
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -327,8 +327,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -363,8 +363,8 @@ EOF
 +c
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -391,16 +391,16 @@ EOF
  10
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got stage >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -409,8 +409,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " M numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -459,8 +459,8 @@ unstage this change? [y/n/q] y
 G  numbers
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -469,8 +469,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "MM numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -505,8 +505,8 @@ EOF
  10
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -530,16 +530,16 @@ EOF
 +c
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got stage >/dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got stage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -548,8 +548,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo " M numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -598,8 +598,8 @@ unstage this change? [y/n/q] y
 G  numbers
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -608,8 +608,8 @@ EOF
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "M  numbers" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -618,8 +618,8 @@ EOF
 	(cd $testroot/wt && got diff -s > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -657,8 +657,8 @@ EOF
 +c
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -670,8 +670,8 @@ test_unstage_patch_added() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -689,8 +689,8 @@ test_unstage_patch_added() {
 	echo "unstage this addition? [y/n] y" >> $testroot/stdout.expected
 	echo "G  epsilon/new" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -699,8 +699,8 @@ test_unstage_patch_added() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "A  epsilon/new" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -709,8 +709,8 @@ test_unstage_patch_added() {
 	(cd $testroot/wt && got diff -s > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -726,8 +726,8 @@ test_unstage_patch_added() {
 	echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
 	echo "+new" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -738,8 +738,8 @@ test_unstage_patch_removed() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -755,8 +755,8 @@ test_unstage_patch_removed() {
 	echo "unstage this deletion? [y/n] y" >> $testroot/stdout.expected
 	echo "D  beta" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -765,8 +765,8 @@ test_unstage_patch_removed() {
 	(cd $testroot/wt && got status > $testroot/stdout)
 	echo "D  beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -775,8 +775,8 @@ test_unstage_patch_removed() {
 	(cd $testroot/wt && got diff -s > $testroot/stdout)
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -795,8 +795,8 @@ test_unstage_patch_removed() {
 	echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
 	echo "-beta" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -812,8 +812,8 @@ test_unstage_patch_quit() {
 	local commit_id=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -829,8 +829,8 @@ test_unstage_patch_quit() {
 	printf "y\nq\nn\n" > $testroot/patchscript
 	(cd $testroot/wt && got unstage -F $testroot/patchscript -p \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -865,8 +865,8 @@ D  zzz
 unstage this deletion? [y/n] n
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -876,8 +876,8 @@ EOF
 	echo "MM numbers" > $testroot/stdout.expected
 	echo " D zzz" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -901,8 +901,8 @@ EOF
 	echo " 4" >> $testroot/stdout.expected
 	echo " 5" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -946,8 +946,8 @@ EOF
 	echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
 	echo "-zzz" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -966,8 +966,8 @@ test_unstage_symlink() {
 	local head_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -996,16 +996,16 @@ test_unstage_symlink() {
  A zeta.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	(cd $testroot/wt && got unstage > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1022,8 +1022,8 @@ G  zeta.link
 EOF
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1038,8 +1038,8 @@ EOF
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1054,8 +1054,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1070,8 +1070,8 @@ EOF
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1086,8 +1086,8 @@ EOF
 	echo "this is regular file foo" > $testroot/content.expected
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1103,8 +1103,8 @@ EOF
 	readlink $testroot/wt/dotgotbar.link > $testroot/stdout
 	echo ".got/bar" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1125,8 +1125,8 @@ EOF
 	readlink $testroot/wt/zeta.link > $testroot/stdout
 	echo "gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1150,8 +1150,8 @@ test_unstage_patch_symlink() {
 	local commit_id1=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1193,8 +1193,8 @@ test_unstage_patch_symlink() {
  A zeta3.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1203,8 +1203,8 @@ EOF
 	printf "y\nn\ny\nn\ny\ny\nn\ny\ny\n" > $testroot/patchscript
 	(cd $testroot/wt && got unstage -F $testroot/patchscript -p \
 		> $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "got unstage command failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1271,8 +1271,8 @@ unstage this addition? [y/n] y
 G  zeta3.link
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1287,8 +1287,8 @@ EOF
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "gamma/delta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1303,8 +1303,8 @@ EOF
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1320,8 +1320,8 @@ EOF
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1330,8 +1330,8 @@ EOF
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../gamma" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1340,8 +1340,8 @@ EOF
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent2" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1355,8 +1355,8 @@ EOF
 	readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
 	echo ".got/foo" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1384,8 +1384,8 @@ EOF
 	readlink $testroot/wt/zeta3.link > $testroot/stdout
 	echo "beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1409,8 +1409,8 @@ EOF
 	echo "D  zeta2.link" >> $testroot/stdout.expected
 	echo "A  zeta3.link" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		return 1
 	fi
blob - 51b2e89261f318fde6e149922ab6d66ef3629aac
blob + 914cb847c018254515703871e7f5f4db64b790b0
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
@@ -20,8 +20,8 @@ test_update_basic() {
 	local testroot=`test_init update_basic`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -37,8 +37,8 @@ test_update_basic() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -48,8 +48,8 @@ test_update_basic() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -59,8 +59,8 @@ test_update_adds_file() {
 	local testroot=`test_init update_adds_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -77,8 +77,8 @@ test_update_adds_file() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -88,8 +88,8 @@ test_update_adds_file() {
 	cat $testroot/wt/gamma/new > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -100,8 +100,8 @@ test_update_deletes_file() {
 
 	mkdir $testroot/wtparent
 	got checkout $testroot/repo $testroot/wtparent/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -121,8 +121,8 @@ test_update_deletes_file() {
 	chmod u+w $testroot/wtparent
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -141,8 +141,8 @@ test_update_deletes_dir() {
 	local testroot=`test_init update_deletes_dir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -158,8 +158,8 @@ test_update_deletes_dir() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -185,8 +185,8 @@ test_update_deletes_dir_with_path_prefix() {
 
 	# check out the epsilon/ sub-tree
 	got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -199,8 +199,8 @@ test_update_deletes_dir_with_path_prefix() {
 	(cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -228,8 +228,8 @@ test_update_deletes_dir_recursively() {
 
 	# check out the epsilon/ sub-tree
 	got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -243,7 +243,7 @@ test_update_deletes_dir_recursively() {
 	(cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
+	ret=$?
 	if [ "$?" != "0" ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
@@ -263,8 +263,8 @@ test_update_sibling_dirs_with_common_prefix() {
 	local testroot=`test_init update_sibling_dirs_with_common_prefix`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -285,8 +285,8 @@ test_update_sibling_dirs_with_common_prefix() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -307,16 +307,16 @@ test_update_sibling_dirs_with_common_prefix() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -326,8 +326,8 @@ test_update_dir_with_dot_sibling() {
 	local testroot=`test_init update_dir_with_dot_sibling`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$ret"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -347,8 +347,8 @@ test_update_dir_with_dot_sibling() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -365,16 +365,16 @@ test_update_dir_with_dot_sibling() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -391,8 +391,8 @@ test_update_moves_files_upwards() {
 	git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -412,8 +412,8 @@ test_update_moves_files_upwards() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -445,8 +445,8 @@ test_update_moves_files_to_new_dir() {
 	git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -467,8 +467,8 @@ test_update_moves_files_to_new_dir() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -499,8 +499,8 @@ test_update_creates_missing_parent() {
 	git_commit $testroot/repo -m "adding initial snake tree"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -534,8 +534,8 @@ test_update_creates_missing_parent() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -551,8 +551,8 @@ test_update_creates_missing_parent_with_subdir() {
 	git_commit $testroot/repo -m "adding initial snake tree"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -586,8 +586,8 @@ test_update_creates_missing_parent_with_subdir() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -608,8 +608,8 @@ test_update_file_in_subsubdir() {
 	git_commit $testroot/repo -m "adding initial tree"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -626,8 +626,8 @@ test_update_file_in_subsubdir() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -652,8 +652,8 @@ test_update_merges_file_edits() {
 	local base_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -678,8 +678,8 @@ test_update_merges_file_edits() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -710,8 +710,8 @@ test_update_merges_file_edits() {
 	cat $testroot/wt/numbers >> $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -726,8 +726,8 @@ test_update_keeps_xbit() {
 	git_commit $testroot/repo -m "adding executable file"
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -741,23 +741,23 @@ test_update_keeps_xbit() {
 	echo >> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rwx'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is not executable" >&2
 		ls -l $testroot/wt/xfile >&2
 	fi
@@ -773,15 +773,15 @@ test_update_clears_xbit() {
 	git_commit $testroot/repo -m "adding executable file"
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rwx'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is not executable" >&2
 		ls -l $testroot/wt/xfile >&2
 		test_done "$testroot" "$ret"
@@ -799,23 +799,23 @@ test_update_clears_xbit() {
 	echo >> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rw-'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is unexpectedly executable" >&2
 		ls -l $testroot/wt/xfile >&2
 	fi
@@ -826,8 +826,8 @@ test_update_restores_missing_file() {
 	local testroot=`test_init update_restores_missing_file`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -841,8 +841,8 @@ test_update_restores_missing_file() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -853,8 +853,8 @@ test_update_restores_missing_file() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -864,8 +864,8 @@ test_update_conflict_wt_add_vs_repo_add() {
 	local testroot=`test_init update_conflict_wt_add_vs_repo_add`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -886,8 +886,8 @@ test_update_conflict_wt_add_vs_repo_add() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -904,8 +904,8 @@ test_update_conflict_wt_add_vs_repo_add() {
 	cat $testroot/wt/gamma/new > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -916,8 +916,8 @@ test_update_conflict_wt_add_vs_repo_add() {
 	echo 'M  gamma/new' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -927,8 +927,8 @@ test_update_conflict_wt_edit_vs_repo_rm() {
 	local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -945,8 +945,8 @@ test_update_conflict_wt_edit_vs_repo_rm() {
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -957,8 +957,8 @@ test_update_conflict_wt_edit_vs_repo_rm() {
 	cat $testroot/wt/beta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -968,8 +968,8 @@ test_update_conflict_wt_edit_vs_repo_rm() {
 	echo 'A  beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -979,8 +979,8 @@ test_update_conflict_wt_rm_vs_repo_edit() {
 	local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -997,8 +997,8 @@ test_update_conflict_wt_rm_vs_repo_edit() {
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1008,8 +1008,8 @@ test_update_conflict_wt_rm_vs_repo_edit() {
 	echo 'D  beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1029,8 +1029,8 @@ test_update_conflict_wt_rm_vs_repo_edit() {
 
 	(cd $testroot/wt && got diff > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1040,8 +1040,8 @@ test_update_conflict_wt_rm_vs_repo_rm() {
 	local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1058,8 +1058,8 @@ test_update_conflict_wt_rm_vs_repo_rm() {
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1071,15 +1071,15 @@ test_update_conflict_wt_rm_vs_repo_rm() {
 	(cd $testroot/wt && got status beta > $testroot/stdout \
 		2> $testroot/stderr)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1098,8 +1098,8 @@ test_update_partial() {
 	local testroot=`test_init update_partial`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1118,8 +1118,8 @@ test_update_partial() {
 	(cd $testroot/wt && got update alpha beta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1130,8 +1130,8 @@ test_update_partial() {
 
 	cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1145,8 +1145,8 @@ test_update_partial() {
 	(cd $testroot/wt && got update epsilon > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1156,8 +1156,8 @@ test_update_partial() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1170,8 +1170,8 @@ test_update_partial_add() {
 	local testroot=`test_init update_partial_add`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1190,8 +1190,8 @@ test_update_partial_add() {
 	(cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1203,8 +1203,8 @@ test_update_partial_add() {
 	cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -1214,8 +1214,8 @@ test_update_partial_rm() {
 	local testroot=`test_init update_partial_rm`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1227,16 +1227,16 @@ test_update_partial_rm() {
 		> $testroot/stderr.expected
 
 	(cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
-	ret="$?"
-	if [ "$ret" = "0" ]; then
+	ret=$?
+	if [ $ret -eq 0 ]; then
 		echo "update succeeded unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1248,8 +1248,8 @@ test_update_partial_dir() {
 	local testroot=`test_init update_partial_dir`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1267,8 +1267,8 @@ test_update_partial_dir() {
 	(cd $testroot/wt && got update epsilon > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1278,8 +1278,8 @@ test_update_partial_dir() {
 	cat $testroot/wt/epsilon/zeta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1297,8 +1297,8 @@ test_update_moved_branch_ref() {
 	git_commit $testroot/repo -m "modified alpha with git"
 
 	got checkout $testroot/repo2 $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1318,16 +1318,16 @@ test_update_moved_branch_ref() {
 	(cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 	fi
 	test_done "$testroot" "$ret"
@@ -1338,16 +1338,16 @@ test_update_to_another_branch() {
 	local base_commit=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	echo 'refs/heads/master'> $testroot/head-ref.expected
 	cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
 		test_done "$testroot" "$ret"
 		return 1
@@ -1369,8 +1369,8 @@ test_update_to_another_branch() {
 	(cd $testroot/wt && got update -b newbranch > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1390,8 +1390,8 @@ test_update_to_another_branch() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1399,8 +1399,8 @@ test_update_to_another_branch() {
 
 	echo 'refs/heads/newbranch'> $testroot/head-ref.expected
 	cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
 		test_done "$testroot" "$ret"
 		return 1
@@ -1413,8 +1413,8 @@ test_update_to_commit_on_wrong_branch() {
 	local testroot=`test_init update_to_commit_on_wrong_branch`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1432,16 +1432,16 @@ test_update_to_commit_on_wrong_branch() {
 		2> $testroot/stderr)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1458,8 +1458,8 @@ test_update_bumps_base_commit_id() {
 	git_commit $testroot/repo -m "adding another file"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1471,8 +1471,8 @@ test_update_bumps_base_commit_id() {
 	echo "M  epsilon/psi" > $testroot/stdout.expected
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1489,8 +1489,8 @@ test_update_bumps_base_commit_id() {
 	echo -n "" > $testroot/stdout.expected
 	echo "got: work tree must be updated before these changes can be committed"  > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -1506,8 +1506,8 @@ test_update_bumps_base_commit_id() {
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1522,8 +1522,8 @@ test_update_bumps_base_commit_id() {
 	echo "M  epsilon/zeta" > $testroot/stdout.expected
 	echo "Created commit $head_rev" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1537,8 +1537,8 @@ test_update_tag() {
 	local tag="1.0.0"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1555,8 +1555,8 @@ test_update_tag() {
 	(cd $testroot/wt && got update -c $tag > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1566,8 +1566,8 @@ test_update_tag() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -1583,15 +1583,15 @@ test_update_toggles_xbit() {
 	local commit_id1=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rwx'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is not executable" >&2
 		ls -l $testroot/wt/xfile >&2
 		test_done "$testroot" "$ret"
@@ -1608,8 +1608,8 @@ test_update_toggles_xbit() {
 	echo >> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1617,8 +1617,8 @@ test_update_toggles_xbit() {
 	echo "U  xfile" > $testroot/stdout.expected
 	echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1626,8 +1626,8 @@ test_update_toggles_xbit() {
 
 
 	ls -l $testroot/wt/xfile | grep -q '^-rwx'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is not executable" >&2
 		ls -l $testroot/wt/xfile >&2
 		test_done "$testroot" "$ret"
@@ -1635,8 +1635,8 @@ test_update_toggles_xbit() {
 	fi
 
 	(cd $testroot/wt && got update > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1645,16 +1645,16 @@ test_update_toggles_xbit() {
 	echo "Updated to refs/heads/master: $commit_id2" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	ls -l $testroot/wt/xfile | grep -q '^-rw-'
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "file is unexpectedly executable" >&2
 		ls -l $testroot/wt/xfile >&2
 	fi
@@ -1670,8 +1670,8 @@ test_update_preserves_conflicted_file() {
 	local commit_id1=`git_show_head $testroot/repo`
 
 	got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -1687,8 +1687,8 @@ test_update_preserves_conflicted_file() {
 	echo "C  alpha" > $testroot/stdout.expected
 	(cd $testroot/wt && got status  > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1703,16 +1703,16 @@ test_update_preserves_conflicted_file() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi
 
 	cmp -s $testroot/content.expected $testroot/wt/alpha
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/wt/alpha
 	fi
 	test_done "$testroot" "$ret"
@@ -1745,8 +1745,8 @@ test_update_modified_submodules() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1773,8 +1773,8 @@ test_update_adds_submodule() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1791,8 +1791,8 @@ test_update_conflict_wt_file_vs_repo_submodule() {
 	echo "This is a file called repo2" > $testroot/wt/repo2
 	(cd $testroot/wt && got add repo2 > /dev/null)
 	(cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "commit failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -1815,8 +1815,8 @@ test_update_conflict_wt_file_vs_repo_submodule() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1826,8 +1826,8 @@ test_update_conflict_wt_file_vs_repo_submodule() {
 
 	echo "M  repo2" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1837,8 +1837,8 @@ test_update_adds_symlink() {
 	local testroot=`test_init update_adds_symlink`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1864,8 +1864,8 @@ test_update_adds_symlink() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1880,8 +1880,8 @@ test_update_adds_symlink() {
 	readlink $testroot/wt/alpha.link > $testroot/stdout
 	echo "alpha" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1896,8 +1896,8 @@ test_update_adds_symlink() {
 	readlink $testroot/wt/epsilon.link > $testroot/stdout
 	echo "epsilon" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1914,8 +1914,8 @@ test_update_adds_symlink() {
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -1924,8 +1924,8 @@ test_update_adds_symlink() {
 	readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
 	echo "../beta" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1934,8 +1934,8 @@ test_update_adds_symlink() {
 	readlink $testroot/wt/nonexistent.link > $testroot/stdout
 	echo "nonexistent" > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -1945,8 +1945,8 @@ test_update_adds_symlink() {
 	echo 'Already up-to-date' > $testroot/stdout.expected
 	(cd $testroot/wt && got update > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 	fi
 	test_done "$testroot" "$ret"
@@ -1960,8 +1960,8 @@ test_update_deletes_symlink() {
 	git_commit $testroot/repo -m "add symlink"
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -1978,8 +1978,8 @@ test_update_deletes_symlink() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2008,8 +2008,8 @@ test_update_symlink_conflicts() {
 	local commit_id1=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "checkout failed unexpectedly" >&2
 		test_done "$testroot" "$ret"
 		return 1
@@ -2064,8 +2064,8 @@ test_update_symlink_conflicts() {
 	echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2090,8 +2090,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/alpha.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2116,8 +2116,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/epsilon.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2134,8 +2134,8 @@ test_update_symlink_conflicts() {
 	cp $testroot/wt/passwd.link $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2160,8 +2160,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/epsilon/beta.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2184,8 +2184,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/nonexistent.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2207,8 +2207,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/dotgotfoo.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2229,8 +2229,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/dotgotbar.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2252,8 +2252,8 @@ test_update_symlink_conflicts() {
 
 	cp $testroot/wt/new.link $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2263,7 +2263,7 @@ test_update_symlink_conflicts() {
 	echo "M  new.link" >> $testroot/stdout.expected
 	echo "D  nonexistent.link" >> $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
-	if [ "$ret" != "0" ]; then
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2293,8 +2293,8 @@ test_update_single_file() {
 	local commit_id3=`git_show_head $testroot/repo`
 
 	got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2307,8 +2307,8 @@ test_update_single_file() {
 		> $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2318,8 +2318,8 @@ test_update_single_file() {
 	cat $testroot/wt/c > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2332,8 +2332,8 @@ test_update_single_file() {
 	(cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2343,8 +2343,8 @@ test_update_single_file() {
 	cat $testroot/wt/c > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2359,8 +2359,8 @@ test_update_single_file() {
 
 	echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stderr.expected $testroot/stderr
 		test_done "$testroot" "$ret"
 		return 1
@@ -2368,8 +2368,8 @@ test_update_single_file() {
 
 	echo -n > $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2381,8 +2381,8 @@ test_update_single_file() {
 
 	(cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2409,8 +2409,8 @@ test_update_file_skipped_due_to_conflict() {
 	blob_id1=`get_blob_id $testroot/repo "" beta`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2440,8 +2440,8 @@ test_update_file_skipped_due_to_conflict() {
 		>> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2460,8 +2460,8 @@ test_update_file_skipped_due_to_conflict() {
 	cat $testroot/wt/beta > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2491,8 +2491,8 @@ test_update_file_skipped_due_to_conflict() {
 	echo "Files not updated because of existing merge conflicts: 1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2522,8 +2522,8 @@ test_update_file_skipped_due_to_conflict() {
 	echo 'C  beta' > $testroot/stdout.expected
 	(cd $testroot/wt && got status > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2536,8 +2536,8 @@ test_update_file_skipped_due_to_conflict() {
 	echo "beta" > $testroot/content.expected
 	cat $testroot/wt/beta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2549,8 +2549,8 @@ test_update_file_skipped_due_to_conflict() {
 	echo "Updated to refs/heads/master: $commit_id1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2575,8 +2575,8 @@ test_update_file_skipped_due_to_conflict() {
 	echo "changed beta" > $testroot/content.expected
 	cat $testroot/wt/beta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -2595,8 +2595,8 @@ test_update_file_skipped_due_to_obstruction() {
 	blob_id1=`get_blob_id $testroot/repo "" beta`
 
 	got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2623,8 +2623,8 @@ test_update_file_skipped_due_to_obstruction() {
 
 	# update to the latest commit; this skips beta and the new file
 	(cd $testroot/wt && got update > $testroot/stdout)
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		echo "update failed unexpectedly" >&2
 		test_done "$testroot" "1"
 		return 1
@@ -2637,8 +2637,8 @@ test_update_file_skipped_due_to_obstruction() {
 	echo "File paths obstructed by a non-regular file: 2" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2672,8 +2672,8 @@ test_update_file_skipped_due_to_obstruction() {
 	echo "File paths obstructed by a non-regular file: 1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2698,8 +2698,8 @@ test_update_file_skipped_due_to_obstruction() {
 	echo "changed beta" > $testroot/content.expected
 	cat $testroot/wt/beta > $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -2709,8 +2709,8 @@ test_update_quiet() {
 	local testroot=`test_init update_quiet`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2725,8 +2725,8 @@ test_update_quiet() {
 	(cd $testroot/wt && got update -q > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2736,8 +2736,8 @@ test_update_quiet() {
 	cat $testroot/wt/alpha > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
 	test_done "$testroot" "$ret"
@@ -2748,8 +2748,8 @@ test_update_binary_file() {
 	local commit_id0=`git_show_head $testroot/repo`
 
 	got checkout $testroot/repo $testroot/wt > /dev/null
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
 		return 1
 	fi
@@ -2785,8 +2785,8 @@ test_update_binary_file() {
 		>> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2797,8 +2797,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2816,8 +2816,8 @@ test_update_binary_file() {
 		>> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2836,8 +2836,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2848,8 +2848,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo-1-* > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2860,8 +2860,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo-2-* > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2880,8 +2880,8 @@ test_update_binary_file() {
 		>> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2892,8 +2892,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2910,8 +2910,8 @@ test_update_binary_file() {
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2934,8 +2934,8 @@ test_update_binary_file() {
 	cat $testroot/wt/foo > $testroot/content
 
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2945,8 +2945,8 @@ test_update_binary_file() {
 	chmod 755 $testroot/content.expected
 	cp $testroot/wt/foo-1-* $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2956,8 +2956,8 @@ test_update_binary_file() {
 	chmod 755 $testroot/content.expected
 	cp $testroot/wt/foo-2-* $testroot/content
 	cmp -s $testroot/content.expected $testroot/content
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/content.expected $testroot/content
 		test_done "$testroot" "$ret"
 		return 1
@@ -2972,8 +2972,8 @@ test_update_binary_file() {
 	echo -n '?  ' >> $testroot/stdout.expected
 	(cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
@@ -2990,8 +2990,8 @@ test_update_binary_file() {
 		>> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
-	ret="$?"
-	if [ "$ret" != "0" ]; then
+	ret=$?
+	if [ $ret -ne 0 ]; then
 		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 	fi