fixup! t: teach test_cmp_rev to accept ! for not-equals
diff mbox series

Message ID 018d2035e0c830d0e184ff209f3f75dd291aa30f.1573587373.git.liu.denton@gmail.com
State New
Headers show
Series
  • fixup! t: teach test_cmp_rev to accept ! for not-equals
Related show

Commit Message

Denton Liu Nov. 12, 2019, 7:38 p.m. UTC
Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
Thanks for the suggestion, Junio. Since it's just a minor cleanup,
here's the fixup patch for it.

 t/test-lib-functions.sh | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Patch
diff mbox series

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 01cdbb0478..15f4c96777 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1016,11 +1016,13 @@  test_must_be_empty () {
 # provided first, that its other two parameters refer to different
 # revisions.
 test_cmp_rev () {
-	local op
+	local op wrong_result
 	op='='
+	wrong_result='different'
 	if test $# -ge 1 && test "x$1" = 'x!'
 	then
 	    op='!='
+	    wrong_result='the same'
 	    shift
 	fi
 	if test $# != 2
@@ -1033,15 +1035,8 @@  test_cmp_rev () {
 
 		if ! test "$r1" "$op" "$r2"
 		then
-			local comp_out
-			if "x$op" = 'x='
-			then
-				comp_out='different'
-			else
-				comp_out='the same'
-			fi
 			cat >&4 <<-EOF
-			error: two revisions point to $comp_out objects:
+			error: two revisions point to $wrong_result objects:
 			  '$1': $r1
 			  '$2': $r2
 			EOF