{"thread":{"id":"8761","subject":"[PATCH] git-tag: Fix the main while loop exit condition.","startedAt":"2007-06-28T16:56:57Z","lastAt":"2007-06-30T06:04:37Z","messageCount":3,"participants":["Alexandre Vassalotti","Junio C Hamano","Sam Vilain"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45990","messageId":"11830498172717-git-send-email-alexandre@peadrop.com","threadId":"8761","inReplyTo":null,"subject":"[PATCH] git-tag: Fix the main while loop exit condition.","fromName":"Alexandre Vassalotti","fromEmail":"alexandre@peadrop.com","sentAt":"2007-06-28T16:56:57Z","receivedAt":"2007-06-28T16:56:57Z","isPatch":true,"sender":{"key":"alexandre@peadrop.com","avatar":null},"body":"This stop git-tag from emitting a \"shift: can't shift that many\"\nerror, when listing tags.\n\nSigned-off-by: Alexandre Vassalotti <alexandre@peadrop.com>\n---\n git-tag.sh |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/git-tag.sh b/git-tag.sh\nindex c840439..bc0d735 100755\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -14,18 +14,20 @@ username=\n list=\n verify=\n LINES=0\n-while case \"$#\" in 0) break ;; esac\n-do\n+while [ $# -ne 0 ]; do\n     case \"$1\" in\n     -a)\n \tannotate=1\n+\tshift\n \t;;\n     -s)\n \tannotate=1\n \tsigned=1\n+\tshift\n \t;;\n     -f)\n \tforce=1\n+\tshift\n \t;;\n     -n)\n         case $2 in\n@@ -36,6 +38,7 @@ do\n \t\t[ -z \"$LINES\" ] && LINES=1 # 1 line is default when -n is used\n \t\t;;\n \tesac\n+\tshift\n \t;;\n     -l)\n \tlist=1\n@@ -122,7 +125,6 @@ do\n \tbreak\n \t;;\n     esac\n-    shift\n done\n \n [ -n \"$list\" ] && exit 0\n-- \n1.5.2.1.144.gabc40\n"},{"id":"46010","messageId":"7vy7i3mxw3.fsf@assigned-by-dhcp.pobox.com","threadId":"8761","inReplyTo":"11830498172717-git-send-email-alexandre@peadrop.com","subject":"Re: [PATCH] git-tag: Fix the main while loop exit condition.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-29T00:01:48Z","receivedAt":"2007-06-29T00:01:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nI think you would need something like this on top if you want to\nreally fix it, though.\n\nI also suspect that we should error out on:\n\n\t$ git tag -l foo bar\n\nbut that will be left as an exercise to the readers ;-)\n\ndiff --git a/git-tag.sh b/git-tag.sh\nindex bc0d735..48b54a1 100755\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -14,7 +14,8 @@ username=\n list=\n verify=\n LINES=0\n-while [ $# -ne 0 ]; do\n+while case \"$#\" in 0) break ;; esac\n+do\n     case \"$1\" in\n     -a)\n \tannotate=1\n@@ -30,8 +31,9 @@ while [ $# -ne 0 ]; do\n \tshift\n \t;;\n     -n)\n-        case $2 in\n-\t-*)\tLINES=1 \t# no argument\n+        case \"$#,$2\" in\n+\t1,* | *,-*)\n+\t\tLINES=1 \t# no argument\n \t\t;;\n \t*)\tshift\n \t\tLINES=$(expr \"$1\" : '\\([0-9]*\\)')\n@@ -43,7 +45,14 @@ while [ $# -ne 0 ]; do\n     -l)\n \tlist=1\n \tshift\n-\tPATTERN=\"$1\"\t# select tags by shell pattern, not re\n+\tcase $# in\n+\t0)\tPATTERN=\n+\t\t;;\n+\t*)\n+\t\tPATTERN=\"$1\"\t# select tags by shell pattern, not re\n+\t\tshift\n+\t\t;;\n+\tesac\n \tgit rev-parse --symbolic --tags | sort |\n \t    while read TAG\n \t    do\n"},{"id":"46065","messageId":"4685F275.8030508@vilain.net","threadId":"8761","inReplyTo":"7vy7i3mxw3.fsf@assigned-by-dhcp.pobox.com","subject":"Re: [PATCH] git-tag: Fix the main while loop exit condition.","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-06-30T06:04:37Z","receivedAt":"2007-06-30T06:04:37Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Thanks.\n> \n> I think you would need something like this on top if you want to\n> really fix it, though.\n> \n> I also suspect that we should error out on:\n> \n> \t$ git tag -l foo bar\n> \n> but that will be left as an exercise to the readers ;-)\n\nMore is required...\n\ndiff --git a/git-tag.sh b/git-tag.sh\nindex 48b54a1..480d16d 100755\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -82,7 +82,9 @@ do\n \tif test \"$#\" = \"0\"; then\n \t    die \"error: option -m needs an argument\"\n \telse\n+\t    message=\"$1\"\n \t    message_given=1\n+\t    shift\n \tfi\n \t;;\n     -F)\n@@ -93,13 +95,19 @@ do\n \telse\n \t    message=\"$(cat \"$1\")\"\n \t    message_given=1\n+\t    shift\n \tfi\n \t;;\n     -u)\n \tannotate=1\n \tsigned=1\n \tshift\n-\tusername=\"$1\"\n+\tif test \"$#\" = \"0\"; then\n+\t    die \"error: option -u needs an argument\"\n+\telse\n+\t    username=\"$1\"\n+\t    shift\n+\tfi\n \t;;\n     -d)\n \tshift\n"}]}