* [PATCH] git-tag: Fix the main while loop exit condition.
@ 2007-06-28 16:56 Alexandre Vassalotti
2007-06-29 0:01 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Vassalotti @ 2007-06-28 16:56 UTC (permalink / raw)
To: git; +Cc: Alexandre Vassalotti
This stop git-tag from emitting a "shift: can't shift that many"
error, when listing tags.
Signed-off-by: Alexandre Vassalotti <alexandre@peadrop.com>
---
git-tag.sh | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/git-tag.sh b/git-tag.sh
index c840439..bc0d735 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -14,18 +14,20 @@ username=
list=
verify=
LINES=0
-while case "$#" in 0) break ;; esac
-do
+while [ $# -ne 0 ]; do
case "$1" in
-a)
annotate=1
+ shift
;;
-s)
annotate=1
signed=1
+ shift
;;
-f)
force=1
+ shift
;;
-n)
case $2 in
@@ -36,6 +38,7 @@ do
[ -z "$LINES" ] && LINES=1 # 1 line is default when -n is used
;;
esac
+ shift
;;
-l)
list=1
@@ -122,7 +125,6 @@ do
break
;;
esac
- shift
done
[ -n "$list" ] && exit 0
--
1.5.2.1.144.gabc40
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] git-tag: Fix the main while loop exit condition.
2007-06-28 16:56 [PATCH] git-tag: Fix the main while loop exit condition Alexandre Vassalotti
@ 2007-06-29 0:01 ` Junio C Hamano
2007-06-30 6:04 ` Sam Vilain
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-06-29 0:01 UTC (permalink / raw)
To: Alexandre Vassalotti; +Cc: git
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] git-tag: Fix the main while loop exit condition.
2007-06-29 0:01 ` Junio C Hamano
@ 2007-06-30 6:04 ` Sam Vilain
0 siblings, 0 replies; 3+ messages in thread
From: Sam Vilain @ 2007-06-30 6:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alexandre Vassalotti, git
Junio C Hamano wrote:
> 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 ;-)
More is required...
diff --git a/git-tag.sh b/git-tag.sh
index 48b54a1..480d16d 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -82,7 +82,9 @@ do
if test "$#" = "0"; then
die "error: option -m needs an argument"
else
+ message="$1"
message_given=1
+ shift
fi
;;
-F)
@@ -93,13 +95,19 @@ do
else
message="$(cat "$1")"
message_given=1
+ shift
fi
;;
-u)
annotate=1
signed=1
shift
- username="$1"
+ if test "$#" = "0"; then
+ die "error: option -u needs an argument"
+ else
+ username="$1"
+ shift
+ fi
;;
-d)
shift
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-30 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-28 16:56 [PATCH] git-tag: Fix the main while loop exit condition Alexandre Vassalotti
2007-06-29 0:01 ` Junio C Hamano
2007-06-30 6:04 ` Sam Vilain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).