public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1•demon.co.uk>
To: Junio C Hamano <gitster@pobox•com>
Cc: GIT Mailing-list <git@vger•kernel.org>, drizzd@aon•at
Subject: [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error
Date: Tue, 21 Dec 2010 18:50:47 +0000	[thread overview]
Message-ID: <4D10F707.1000206@ramsay1.demon.co.uk> (raw)


Some shells, for example dash versions older than 0.5.4, need to
spell a variable reference as '$N' rather than 'N' in an arithmetic
expansion. In order to avoid the syntax error, we change the
offending variable reference from 'i' to '$i' in function scramble.

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

Note that this test is unique in having an '#!/bin/bash' line (rather
than '#!/bin/sh'), which was (indirectly) responsible for me not
noticing this failure for a while. I don't see anything that would
require bash, so I suspect this is not intensional.

ATB,
Ramsay Jones

 t/t3419-rebase-patch-id.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
index 1aee483..6972b49 100755
--- a/t/t3419-rebase-patch-id.sh
+++ b/t/t3419-rebase-patch-id.sh
@@ -27,7 +27,7 @@ scramble()
 		then
 			echo "$x"
 		fi
-		i=$(((i+1) % 10))
+		i=$((($i+1) % 10))
 	done < "$1" > "$1.new"
 	mv -f "$1.new" "$1"
 }
-- 
1.7.3

             reply	other threads:[~2010-12-21 19:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 18:50 Ramsay Jones [this message]
2010-12-21 20:24 ` [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error Junio C Hamano
2010-12-22 18:42 ` Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D10F707.1000206@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1$(echo .)demon.co.uk \
    --cc=drizzd@aon$(echo .)at \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox