Re: [PATCH] git-tag: Fix the main while loop exit condition.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 29, 2007, 00:01 UTC
- Message-ID
- <7vy7i3mxw3.fsf@assigned-by-dhcp.pobox.com>
- In-Reply-To
- <11830498172717-git-send-email-alexandre@peadrop.com>
Thanks.
I think you would need something like this on top if you want to really fix it, though.
I also suspect that we should error out on:
$ git tag -l foo bar
but that will be left as an exercise to the readers ;-)
diff --git a/git-tag.sh b/git-tag.sh index bc0d735..48b54a1 100755 --- a/git-tag.sh +++ b/git-tag.sh @@ -14,7 +14,8 @@ username= list= verify= LINES=0 -while [ $# -ne 0 ]; do +while case "$#" in 0) break ;; esac +do case "$1" in -a) annotate=1 @@ -30,8 +31,9 @@ while [ $# -ne 0 ]; do shift ;; -n) - case $2 in - -*) LINES=1 # no argument + case "$#,$2" in + 1,* | *,-*) + LINES=1 # no argument ;; *) shift LINES=$(expr "$1" : '\([0-9]*\)') @@ -43,7 +45,14 @@ while [ $# -ne 0 ]; do -l) list=1 shift - PATTERN="$1" # select tags by shell pattern, not re + case $# in + 0) PATTERN= + ;; + *) + PATTERN="$1" # select tags by shell pattern, not re + shift + ;; + esac git rev-parse --symbolic --tags | sort | while read TAG do