git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator
@ 2012-05-26 16:51 Ramsay Jones
  2012-05-26 22:21 ` Jon Seymour
  2012-05-27  6:53 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Ramsay Jones @ 2012-05-26 16:51 UTC (permalink / raw
  To: jon.seymour; +Cc: Junio C Hamano, GIT Mailing-list


Some shells, including dash, do not support using the '==' string
equality operator. This results in the failure of tests 7-12 with
'test' complaining of an "unexpected operator".

In order to suppress the errors, we replace the '==' operator with
'=', which must be supported by any POSIX shell.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Jon,

If you need to re-roll your patches from the 'js/submodule-relative'
branch (commits 3f4542e and efa4c90), could you please squash this
fix into them.

Thanks!

ATB,
Ramsay Jones

 t/t7403-submodule-sync.sh |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 583fe21..3d85739 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -93,7 +93,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form foo' '
 	 git remote set-url origin foo
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../submodule"
+	 test "$(git config remote.origin.url)" = "../submodule"
 	)
 	)
 '
@@ -103,7 +103,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form foo/bar
 	 git remote set-url origin foo/bar
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../foo/submodule"
+	 test "$(git config remote.origin.url)" = "../foo/submodule"
 	)
 	)
 '
@@ -113,7 +113,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form ./foo'
 	 git remote set-url origin ./foo
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../submodule"
+	 test "$(git config remote.origin.url)" = "../submodule"
 	)
 	)
 '
@@ -123,7 +123,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form ./foo/b
 	 git remote set-url origin ./foo/bar
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../foo/submodule"
+	 test "$(git config remote.origin.url)" = "../foo/submodule"
 	)
 	)
 '
@@ -133,7 +133,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form ../foo'
 	 git remote set-url origin ../foo
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../../submodule"
+	 test "$(git config remote.origin.url)" = "../../submodule"
 	)
 	)
 '
@@ -143,7 +143,7 @@ test_expect_success '"git submodule sync" handles origin URL of the form ../foo/
 	 git remote set-url origin ../foo/bar
 	 git submodule sync &&
 	(cd submodule &&
-	 test "$(git config remote.origin.url)" == "../../foo/submodule"
+	 test "$(git config remote.origin.url)" = "../../foo/submodule"
 	)
 	)
 '
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator
  2012-05-26 16:51 [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator Ramsay Jones
@ 2012-05-26 22:21 ` Jon Seymour
  2012-05-27  6:53 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Jon Seymour @ 2012-05-26 22:21 UTC (permalink / raw
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list, Jens Lehmann

On Sun, May 27, 2012 at 2:51 AM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
>
> Some shells, including dash, do not support using the '==' string
> equality operator. This results in the failure of tests 7-12 with
> 'test' complaining of an "unexpected operator".
>
> In order to suppress the errors, we replace the '==' operator with
> '=', which must be supported by any POSIX shell.
>

Thanks. I take it than an example of such a shell is dash?

BTW: the next iteration is more of a re-write than a re-roll because I
noticed some other issues (e.g. preventing git://hostname/repo being
silently transformed to git://subrepo in the case of a pathological
use of a submodule URL of the form ../../subrepo) and fixing this
required a change that required a more extensive suite of tests.


jon.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator
  2012-05-26 16:51 [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator Ramsay Jones
  2012-05-26 22:21 ` Jon Seymour
@ 2012-05-27  6:53 ` Junio C Hamano
  2012-05-27  7:01   ` Jon Seymour
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-05-27  6:53 UTC (permalink / raw
  To: Ramsay Jones; +Cc: jon.seymour, GIT Mailing-list

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Some shells, including dash, do not support using the '==' string
> equality operator. This results in the failure of tests 7-12 with
> 'test' complaining of an "unexpected operator".

Thanks.  You do not have to single-out dash.
A shell script that uses "test $a == $b" is *buggy* and not conforming to
POSIX.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator
  2012-05-27  6:53 ` Junio C Hamano
@ 2012-05-27  7:01   ` Jon Seymour
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Seymour @ 2012-05-27  7:01 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Ramsay Jones, GIT Mailing-list

On Sun, May 27, 2012 at 4:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
>
>> Some shells, including dash, do not support using the '==' string
>> equality operator. This results in the failure of tests 7-12 with
>> 'test' complaining of an "unexpected operator".
>
> Thanks.  You do not have to single-out dash.
> A shell script that uses "test $a == $b" is *buggy* and not conforming to
> POSIX.

Yep. This slipped through because I happen to have reconfigured my
/bin/sh to point to bash (frrom Ubuntu's default of dash) because of
an issue with a product installation script. This shouldn't have been
a problem if bash's POSIX mode was strict about rejecting == but bash
doesn't seem to be strict about this.

Anyway, I have reverted /bin/sh to refer to dash so hopefully I won't
be caught by this in future.

jon.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-27  7:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-26 16:51 [PATCH] t7403-*.sh: Avoid use of the nonportable '==' operator Ramsay Jones
2012-05-26 22:21 ` Jon Seymour
2012-05-27  6:53 ` Junio C Hamano
2012-05-27  7:01   ` Jon Seymour

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).