All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-submodule.sh: separate parens by a space to avoid confusing some shells
@ 2011-05-26 20:52 Brandon Casey
  0 siblings, 0 replies; only message in thread
From: Brandon Casey @ 2011-05-26 20:52 UTC (permalink / raw)
  To: gitster; +Cc: git, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

Some shells interpret '(( ))' according to the rules for arithmetic
expansion.  This may not follow POSIX, but is prevalent in commonly used
shells.  Bash does not have a problem with this particular instance of
'((', likely because it is not followed by a '))', but the public domain
ksh does, and so does ksh on IRIX 6.5.

So, add a space between the parenthesis to avoid confusing these shells.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 git-submodule.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index bf110e9..d189a24 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -495,7 +495,7 @@ cmd_update()
 				# Run fetch only if $sha1 isn't present or it
 				# is not reachable from a ref.
 				(clear_local_git_env; cd "$path" &&
-					((rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
+					( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
 					 test -z "$rev") || git-fetch)) ||
 				die "Unable to fetch in submodule path '$path'"
 			fi
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-26 21:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 20:52 [PATCH] git-submodule.sh: separate parens by a space to avoid confusing some shells Brandon Casey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.