git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use "=" instead of "==" in condition as it is more portable

From
Alex Riesen <raa.lkml@gmail.com>
Date
Apr 28, 2008, 21:09 UTC
Message-ID
<20080428210955.GB10600@steel.home>
In-Reply-To
<20080428163642.GA22790@neumann>
At least the dash from Ubuntu's /bin/sh says:
    test: 233: ==: unexpected operator
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
SZEDER Gábor, Mon, Apr 28, 2008 18:36:42 +0200:
Show 12 quoted lines
> On Wed, Apr 23, 2008 at 10:53:47AM -0700, Junio C Hamano wrote:
> > "git clone [options] $src $dst excess-garbage" simply ignored
> > excess-garbage without giving any diagnostic message.  Fix it.
> > 
> >  	dir="$2"
> > +	test $# == 2 || die "excess parameter to git-clone"
>                 ^^
> I think you mean:
> 
>     test $# = 2 || die "excess parameter to git-clone"
> 
> I just noticed because it broke t1020-subdirectory at me.

And me. Almost every test which uses git-clone (I expect some don't test its exit code in setup routines).

 git-clone.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 9e433c0..8c7fc7f 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -219,7 +219,7 @@ fi
 if test -n "$2"
 then
 	dir="$2"
-	test $# == 2 || die "excess parameter to git-clone"
+	test $# = 2 || die "excess parameter to git-clone"
 else
 	# Derive one from the repository name
 	# Try using "humanish" part of source repo if user didn't specify one
-- 
1.5.5.1.118.g6dd1b6.dirty
Previous: SZEDER Gábor
Message 3 of 3 in “clone: detect and fail on excess parameters”
  1. clone: detect and fail on excess parametersJunio C Hamano, Apr 23, 2008
  2. SZEDER GáborApr 28, 2008
  3. Use "=" instead of "==" in condition as it is more portableAlex Riesen, Apr 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.