Skip to content

Commit

Permalink
t1503: Fix arithmetic expansion syntax error when using dash
Browse files Browse the repository at this point in the history
On systems which have dash as /bin/sh, such as Ubuntu, the final
test (master@{n} for various n) fails with a syntax error while
processing an arithmetic expansion. The syntax error is caused by
using a bare name ('N') as a variable reference in the expression.

In order to avoid the syntax error, we spell the variable reference
as '$N' rather than simply 'N'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and Junio C Hamano committed Sep 27, 2010
1 parent 4af3fab commit 4098f67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions t/t1503-rev-parse-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ test_expect_success 'use --default' '

test_expect_success 'master@{n} for various n' '
N=$(git reflog | wc -l) &&
Nm1=$((N-1)) &&
Np1=$((N+1)) &&
Nm1=$(($N-1)) &&
Np1=$(($N+1)) &&
git rev-parse --verify master@{0} &&
git rev-parse --verify master@{1} &&
git rev-parse --verify master@{$Nm1} &&
Expand Down

0 comments on commit 4098f67

Please sign in to comment.