Michał Kiedrowicz <michal.kiedrowicz <at> gmail.com> writes:
> Junio C Hamano <gitster <at> pobox.com> wrote:
> > diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> > index c8b4ae3..7dc70eb 100644
> > --- a/t/test-lib-functions.sh
> > +++ b/t/test-lib-functions.sh
> > @@ -543,11 +543,12 @@ test_cmp() {
> >  #  done
> >  
> >  test_seq () {
> > -   test $# = 2 && { first=$1; shift; } || first=1
> > -   test $# = 1 ||
> > -   error "bug in the test script: not 1 or 2 parameters to test_seq"
> > -   last=$1
> > -   "$PERL_PATH" -le 'print for "$ARGV[0]".."$ARGV[1]"' "$first" "$last"
> > +   case $# in
> > +   1)      set 1 "$@" ;;
> > +   2)      ;;
> > +   *)      error "bug in the test script: not 1 or 2 parameters to 
test_seq" ;;
> > +   esac
> > +   "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' "$@"
> >  }
> >  
> >  # This function can be used to schedule some commands to be run

-- >8 --
Subject: [PATCH] Fixup test_seq: ensure arguments passed to script.

If the arguments passed to to test_seq start with '-' (e.g. negative
integers) they are considered perl options and the program errors.  By
prefixing the user argument list with '--' when passing to perl, this
is avoid and sequences involving negative numbers are possible.
---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 5a1a95a..ed44f5e 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -539,7 +539,7 @@ test_seq () {
        2)      ;;
        *)      error "bug in the test script: not 1 or 2 parameters to 
test_seq" ;;
        esac
-       "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' "$@"
+       "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
 }
 
 # This function can be used to schedule some commands to be run
-- 
1.7.11.msysgit.1.1.gf0affa1


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to