{"thread":{"id":"2826","subject":"[PATCH 8/11] git-lost-found: Usage string clean-up, emit usage string at incorrect invocation","startedAt":"2005-12-13T22:30:30Z","lastAt":"2005-12-15T20:42:42Z","messageCount":17,"participants":["freku045@student.liu.se","Junio C Hamano","Timo Hirvonen","Fredrik Kuivinen","Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":11},"messages":[{"id":"13595","messageId":"11345130302438-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":null,"subject":"[PATCH 0/11] Usage string clean-up","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:30Z","receivedAt":"2005-12-13T22:30:30Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Hi,\n\nThis is a redone version of the usage string clean-up patch series. It\nshould apply cleanly on top of the current 'pu' branch.\n\nThis version is supposed to get the details right.\n\nThe scripts are supposed to set the variable USAGE to some suitable\nvalue before they source git-sh-setup. Optionally they can also set\nLONG_USAGE to a more descriptive help message.\n\n* --help makes the scripts print the (long) usage string and exit\n  cleanly.\n* Unrecognized options prints the usage string and exits non-cleanly.\n* The printed string is of the form \"Usage: $0 options\". The \"Usage:\n  $0 \" part can easily be changed by changing git-sh-setup.sh\n\nThe real value of this series is that all commands prints a usage\nmessage when they get '--help'.\n\nI have left *.perl for a later patch.\n\n git-add.sh           |   13 +++----------\n git-am.sh            |   10 +++-------\n git-applymbox.sh     |    6 +-----\n git-applypatch.sh    |    4 ++++\n git-checkout.sh      |    6 ++----\n git-cherry.sh        |   13 +++++--------\n git-clone.sh         |    2 +-\n git-commit.sh        |    5 +----\n git-count-objects.sh |    4 +++-\n git-fetch.sh         |    5 +++++\n git-format-patch.sh  |   25 ++++++++-----------------\n git-grep.sh          |    7 +++++--\n git-lost-found.sh    |   10 +++++++++-\n git-merge.sh         |    6 ++----\n git-prune.sh         |    3 ++-\n git-pull.sh          |   13 ++-----------\n git-push.sh          |    7 ++-----\n git-rebase.sh        |    5 +++--\n git-repack.sh        |    2 ++\n git-request-pull.sh  |   12 +++++-------\n git-reset.sh         |    6 ++----\n git-resolve.sh       |    6 ++----\n git-revert.sh        |   19 +++++--------------\n git-tag.sh           |   14 +++-----------\n git-verify-tag.sh    |   14 ++++++++------\n 25 files changed, 88 insertions(+), 129 deletions(-)\n\n- Fredrik\n"},{"id":"13583","messageId":"1134513031645-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 8/11] git-lost-found: Usage string clean-up, emit usage string at incorrect invocation","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-lost-found.sh |   10 +++++++++-\n 1 files changed, 9 insertions(+), 1 deletions(-)\n\n240de5191779f0637fb339a80a76770ee35f5a68\ndiff --git a/git-lost-found.sh b/git-lost-found.sh\nindex 2beec2a..ba6d587 100755\n--- a/git-lost-found.sh\n+++ b/git-lost-found.sh\n@@ -1,6 +1,14 @@\n #!/bin/sh\n \n-GIT_DIR=`git-rev-parse --git-dir` || exit $?\n+USAGE=''\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n+\n+if [ \"$#\" != \"0\" ]\n+then\n+    usage\n+fi\n+\n laf=\"$GIT_DIR/lost-found\"\n rm -fr \"$laf\" && mkdir -p \"$laf/commit\" \"$laf/other\" || exit\n \n-- \n0.99.9.GIT\n"},{"id":"13584","messageId":"11345130311665-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 4/11] git-am: Usage string clean-up","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-am.sh |   10 +++-------\n 1 files changed, 3 insertions(+), 7 deletions(-)\n\n243b906a6786cd7401285cacaf9ade994ff83db8\ndiff --git a/git-am.sh b/git-am.sh\nindex 6ed527c..39f2552 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -1,14 +1,10 @@\n #!/bin/sh\n #\n #\n-. git-sh-setup\n \n-usage () {\n-    echo >&2 \"usage: $0 [--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>\"\n-    echo >&2 \"\tor, when resuming\"\n-    echo >&2 \"\t$0 [--skip | --resolved]\"\n-    exit 1;\n-}\n+USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>\n+  or, when resuming [--skip | --resolved]'\n+. git-sh-setup\n \n stop_here () {\n     echo \"$1\" >\"$dotest/next\"\n-- \n0.99.9.GIT\n"},{"id":"13585","messageId":"1134513031450-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 3/11] git-revert: Usage string clean-up","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-revert.sh |   19 +++++--------------\n 1 files changed, 5 insertions(+), 14 deletions(-)\n\n16ecbff0d2e6cf51ff92f081ad66b5bcc3883e31\ndiff --git a/git-revert.sh b/git-revert.sh\nindex 9d499c4..63d201b 100755\n--- a/git-revert.sh\n+++ b/git-revert.sh\n@@ -3,29 +3,20 @@\n # Copyright (c) 2005 Linus Torvalds\n # Copyright (c) 2005 Junio C Hamano\n #\n-. git-sh-setup\n \n case \"$0\" in\n *-revert* )\n \ttest -t 0 && edit=-e\n-\tme=revert ;;\n+\tme=revert\n+\tUSAGE='[--edit | --no-edit] [-n] <commit-ish>' ;;\n *-cherry-pick* )\n \tedit=\n-\tme=cherry-pick ;;\n+\tme=cherry-pick\n+\tUSAGE='[--edit] [-n] [-r] <commit-ish>'  ;;\n * )\n \tdie \"What are you talking about?\" ;;\n esac\n-\n-usage () {\n-\tcase \"$me\" in\n-\tcherry-pick)\n-\t\tdie \"usage git $me [--edit] [-n] [-r] <commit-ish>\"\n-\t\t;;\n-\trevert)\n-\t\tdie \"usage git $me [--edit | --no-edit] [-n] <commit-ish>\"\n-\t\t;;\n-\tesac\n-}\n+. git-sh-setup\n \n no_commit= replay=\n while case \"$#\" in 0) break ;; esac\n-- \n0.99.9.GIT\n"},{"id":"13586","messageId":"11345130314120-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 2/11] git-verify-tag: Usage string clean-up, emit usage string at incorrect invocation","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-verify-tag.sh |   14 ++++++++------\n 1 files changed, 8 insertions(+), 6 deletions(-)\n\ne1bab3098c4926a09cb74dc767d03fd0f3bf8343\ndiff --git a/git-verify-tag.sh b/git-verify-tag.sh\nindex 1f44da5..726b1e7 100755\n--- a/git-verify-tag.sh\n+++ b/git-verify-tag.sh\n@@ -1,11 +1,13 @@\n #!/bin/sh\n \n-GIT_DIR=`git-rev-parse --git-dir` || exit $?\n-\n-die () {\n-    echo >&2 \"$*\"\n-    exit 1\n-}\n+USAGE='<tag>'\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n+\n+if [ \"$#\" != \"1\" ]\n+then\n+  usage\n+fi\n \n type=\"$(git-cat-file -t \"$1\" 2>/dev/null)\" ||\n \tdie \"$1: no such object.\"\n-- \n0.99.9.GIT\n"},{"id":"13587","messageId":"11345130313731-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 1/11] Trivial usage string clean-up","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"\n\nSigned-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\nThis patch contains all 'trivial' changes in this series. In\nparticular, there are no argument parsing changes here.\n\n git-add.sh           |   13 +++----------\n git-applymbox.sh     |    6 +-----\n git-checkout.sh      |    6 ++----\n git-clone.sh         |    2 +-\n git-commit.sh        |    5 +----\n git-format-patch.sh  |   25 ++++++++-----------------\n git-grep.sh          |    7 +++++--\n git-merge.sh         |    6 ++----\n git-pull.sh          |   13 ++-----------\n git-push.sh          |    7 ++-----\n git-request-pull.sh  |   12 +++++-------\n git-reset.sh         |    6 ++----\n git-resolve.sh       |    6 ++----\n git-tag.sh           |   14 +++-----------\n 14 files changed, 39 insertions(+), 89 deletions(-)\n\n50fb9150eb63cd5a4aebeae401f771bd8d1827aa\ndiff --git a/git-add.sh b/git-add.sh\nindex fdec86d..f719b4b 100755\n--- a/git-add.sh\n+++ b/git-add.sh\n@@ -1,13 +1,8 @@\n #!/bin/sh\n \n-die () {\n-    echo >&2 \"$*\"\n-    exit 1\n-}\n-\n-usage() {\n-    die \"usage: git add [-n] [-v] <file>...\"\n-}\n+USAGE='[-n] [-v] <file>...'\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n \n show_only=\n verbose=\n@@ -29,8 +24,6 @@ while : ; do\n   shift\n done\n \n-GIT_DIR=$(git-rev-parse --git-dir) || exit\n-\n if test -f \"$GIT_DIR/info/exclude\"\n then\n \tgit-ls-files -z \\\ndiff --git a/git-applymbox.sh b/git-applymbox.sh\nindex c686cc8..61c8c02 100755\n--- a/git-applymbox.sh\n+++ b/git-applymbox.sh\n@@ -18,13 +18,9 @@\n ##\n ## git-am is supposed to be the newer and better tool for this job.\n \n+USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]'\n . git-sh-setup\n \n-usage () {\n-    echo >&2 \"applymbox [-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]\"\n-    exit 1\n-}\n-\n keep_subject= query_apply= continue= utf8= resume=t\n while case \"$#\" in 0) break ;; esac\n do\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex 4cf30e2..f241d4b 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -1,9 +1,7 @@\n #!/bin/sh\n-. git-sh-setup\n \n-usage () {\n-    die \"usage: git checkout [-f] [-b <new_branch>] [<branch>] [<paths>...]\"\n-}\n+USAGE='[-f] [-b <new_branch>] [<branch>] [<paths>...]'\n+. git-sh-setup\n \n old=$(git-rev-parse HEAD)\n new=\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 699205e..4a7aeef 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -9,7 +9,7 @@\n unset CDPATH\n \n usage() {\n-\techo >&2 \"* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]\"\n+\techo >&2 \"Usage: $0 [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]\"\n \texit 1\n }\n \ndiff --git a/git-commit.sh b/git-commit.sh\nindex 3d250ec..7e39c10 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -3,12 +3,9 @@\n # Copyright (c) 2005 Linus Torvalds\n #\n \n+USAGE='[-a] [-s] [-v | --no-verify]  [-m <message> | -F <logfile> | (-C|-c) <commit>] [-e] [<path>...]'\n . git-sh-setup\n \n-usage () {\n-\tdie 'git commit [-a] [-s] [-v | --no-verify]  [-m <message> | -F <logfile> | (-C|-c) <commit>] [-e] [<path>...]'\n-}\n-\n all= logfile= use_commit= no_edit= log_given= log_message= verify=t signoff=\n while case \"$#\" in 0) break;; esac\n do\ndiff --git a/git-format-patch.sh b/git-format-patch.sh\nindex 921feee..01508e3 100755\n--- a/git-format-patch.sh\n+++ b/git-format-patch.sh\n@@ -3,19 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n-. git-sh-setup\n-\n-# Force diff to run in C locale.\n-LANG=C LC_ALL=C\n-export LANG LC_ALL\n-\n-usage () {\n-    echo >&2 \"usage: $0\"' [-n] [-o dir | --stdout] [--keep-subject] [--mbox]\n-    [--check] [--signoff] [-<diff options>...]\n-    [--help]\n-    ( from..to ... | upstream [ our-head ] )\n-\n-Prepare each commit with its patch since our-head forked from upstream,\n+USAGE='[-n | -k] [-o <dir> | --stdout] [--signoff] [--check] [--mbox] [--diff-options] <upstream> [<our-head>]'\n+LONG_USAGE='Prepare each commit with its patch since our-head forked from upstream,\n one file per patch, for e-mail submission.  Each output file is\n numbered sequentially from 1, and uses the first line of the commit\n message (massaged for pathname safety) as the filename.\n@@ -28,10 +17,12 @@ as \"[PATCH N/M] Subject\", unless you hav\n \n When --mbox is specified, the output is formatted to resemble\n UNIX mailbox format, and can be concatenated together for processing\n-with applymbox.\n-'\n-    exit 1\n-}\n+with applymbox.'\n+. git-sh-setup\n+\n+# Force diff to run in C locale.\n+LANG=C LC_ALL=C\n+export LANG LC_ALL\n \n diff_opts=\n LF='\ndiff --git a/git-grep.sh b/git-grep.sh\nindex 44c1613..2ed8e95 100755\n--- a/git-grep.sh\n+++ b/git-grep.sh\n@@ -3,6 +3,10 @@\n # Copyright (c) Linus Torvalds, 2005\n #\n \n+USAGE='<option>... <pattern> <path>...'\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n+\n pattern=\n flags=()\n git_flags=()\n@@ -40,8 +44,7 @@ while : ; do\n \tshift\n done\n [ \"$pattern\" ] || {\n-\techo >&2 \"usage: 'git grep <pattern> [pathspec*]'\"\n-\texit 1\n+\tusage\n }\n git-ls-files -z \"${git_flags[@]}\" \"$@\" |\n \txargs -0 grep \"${flags[@]}\" -e \"$pattern\"\ndiff --git a/git-merge.sh b/git-merge.sh\nindex a221daa..bed1ffd 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -3,15 +3,13 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n+\n+USAGE='[-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+'\n . git-sh-setup\n \n LF='\n '\n \n-usage () {\n-    die \"git-merge [-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+\"\n-}\n-\n all_strategies='recursive octopus resolve stupid ours'\n default_strategies='recursive'\n use_strategies=\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 3a13984..0991d5f 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -4,19 +4,10 @@\n #\n # Fetch one or more remote refs and merge it/them into the current HEAD.\n \n+USAGE='[-n | --no-summary] [--no-commit] [-s strategy]... [<fetch-options>] <repo> <head>...'\n+LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'\n . git-sh-setup\n \n-usage () {\n-    echo >&2 \"usage: $0\"' [-n] [--no-commit] [--no-summary] [--help]\n-    [-s strategy]...\n-    [<fetch-options>]\n-    <repo> <head>...\n-\n-Fetch one or more remote refs and merge it/them into the current HEAD.\n-'\n-    exit 1\n-}\n-\n strategy_args= no_summary= no_commit=\n while case \"$#,$1\" in 0) break ;; *,-*) ;; *) break ;; esac\n do\ndiff --git a/git-push.sh b/git-push.sh\nindex 140c8f8..1c5cf80 100755\n--- a/git-push.sh\n+++ b/git-push.sh\n@@ -1,10 +1,7 @@\n #!/bin/sh\n-. git-sh-setup\n-\n-usage () {\n-    die \"Usage: git push [--all] [--force] <repository> [<refspec>]\"\n-}\n \n+USAGE='[--all] [--force] <repository> [<refspec>...]'\n+. git-sh-setup\n \n # Parse out parameters and then stop at remote, so that we can\n # translate it using .git/branches information\ndiff --git a/git-request-pull.sh b/git-request-pull.sh\nindex ae6cd27..2c48bfb 100755\n--- a/git-request-pull.sh\n+++ b/git-request-pull.sh\n@@ -4,13 +4,11 @@\n # This file is licensed under the GPL v2, or a later version\n # at the discretion of Linus Torvalds.\n \n-usage()\n-{\n-\techo \"$0 <commit> <url> [ <head> ]\"\n-\techo \"  Summarizes the changes since <commit> to the standard output,\"\n-\techo \"  and includes <url> in the message generated.\"\n-\texit 1\n-}\n+USAGE='<commit> <url> [<head>]'\n+LONG_USAGE='Summarizes the changes since <commit> to the standard output,\n+and includes <url> in the message generated.'\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n \n revision=$1\n url=$2\ndiff --git a/git-reset.sh b/git-reset.sh\nindex 72ef303..eb44ee8 100755\n--- a/git-reset.sh\n+++ b/git-reset.sh\n@@ -1,9 +1,7 @@\n #!/bin/sh\n-. git-sh-setup\n \n-usage () {\n-\tdie 'Usage: git reset [--mixed | --soft | --hard]  [<commit-ish>]'\n-}\n+USAGE='[--mixed | --soft | --hard]  [<commit-ish>]'\n+. git-sh-setup\n \n tmp=/var/tmp/reset.$$\n trap 'rm -f $tmp-*' 0 1 2 3 15\ndiff --git a/git-resolve.sh b/git-resolve.sh\nindex fcc5ad7..9263070 100755\n--- a/git-resolve.sh\n+++ b/git-resolve.sh\n@@ -4,11 +4,9 @@\n #\n # Resolve two trees.\n #\n-. git-sh-setup\n \n-usage () {\n-\tdie \"git-resolve <head> <remote> <merge-message>\"\n-}\n+USAGE='<head> <remote> <merge-message>'\n+. git-sh-setup\n \n dropheads() {\n \trm -f -- \"$GIT_DIR/MERGE_HEAD\" \\\ndiff --git a/git-tag.sh b/git-tag.sh\nindex 2435a75..6d0c973 100755\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -1,17 +1,9 @@\n #!/bin/sh\n # Copyright (c) 2005 Linus Torvalds\n \n-GIT_DIR=`git-rev-parse --git-dir` || exit $?\n-\n-usage () {\n-    echo >&2 \"Usage: git-tag [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]\"\n-    exit 1\n-}\n-\n-die () {\n-    echo >&2 \"$*\"\n-    exit 1\n-}\n+USAGE='[-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]'\n+SUBDIRECTORY_OK='Yes'\n+. git-sh-setup\n \n annotate=\n signed=\n-- \n0.99.9.GIT\n"},{"id":"13591","messageId":"11345130311492-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-applypatch.sh |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\n4aecb38bdf7d1f22bec895d0b3a936ded39bef4d\ndiff --git a/git-applypatch.sh b/git-applypatch.sh\nindex a112e1a..214f5c3 100755\n--- a/git-applypatch.sh\n+++ b/git-applypatch.sh\n@@ -10,8 +10,12 @@\n ##\t$3 - \"info\" file with Author, email and subject\n ##\t$4 - optional file containing signoff to add\n ##\n+\n+USAGE='<msg> <patch> <info> [<signoff>]'\n . git-sh-setup\n \n+[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n+\n final=.dotest/final-commit\n ##\n ## If this file exists, we ask before applying\n-- \n0.99.9.GIT\n"},{"id":"13592","messageId":"11345130313062-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 7/11] git-fetch: Usage string clean-up, emit usage string at unrecognized option","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-fetch.sh |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\n64d3f091f8cfa405ee479f49c4890ae452ac0afd\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 14ea295..767ca61 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -1,5 +1,7 @@\n #!/bin/sh\n #\n+\n+USAGE='<fetch-options> <repository> <refspec>...'\n . git-sh-setup\n . git-parse-remote\n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n@@ -34,6 +36,9 @@ do\n \t-v|--verbose)\n \t\tverbose=Yes\n \t\t;;\n+\t-*)\n+\t\tusage\n+\t\t;;\n \t*)\n \t\tbreak\n \t\t;;\n-- \n0.99.9.GIT\n"},{"id":"13594","messageId":"1134513031495-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 6/11] git-cherry: Usage string clean-up, use the 'usage' function","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:31Z","receivedAt":"2005-12-13T22:30:31Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-cherry.sh |   13 +++++--------\n 1 files changed, 5 insertions(+), 8 deletions(-)\n\na3b435a4c9bbde849dbe1aac1431387d673cf754\ndiff --git a/git-cherry.sh b/git-cherry.sh\nindex 867522b..5e9bd0c 100755\n--- a/git-cherry.sh\n+++ b/git-cherry.sh\n@@ -3,11 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-. git-sh-setup\n-\n-usage=\"usage: $0 \"'[-v] <upstream> [<head>]\n-\n-             __*__*__*__*__> <upstream>\n+USAGE='[-v] <upstream> [<head>]'\n+LONG_USAGE='             __*__*__*__*__> <upstream>\n             /\n   fork-point\n             \\__+__+__+__+__+__+__+__> <head>\n@@ -16,8 +13,8 @@ Each commit between the fork-point and <\n compared against the change each commit between the fork-point and\n <upstream> introduces.  If the change seems to be in the upstream,\n it is shown on the standard output with prefix \"+\".  Otherwise\n-it is shown with prefix \"-\".\n-'\n+it is shown with prefix \"-\".'\n+. git-sh-setup\n \n case \"$1\" in -v) verbose=t; shift ;; esac \n \n@@ -35,7 +32,7 @@ case \"$#\" in\n 2) upstream=`git-rev-parse --verify \"$1\"` &&\n    ours=`git-rev-parse --verify \"$2\"` || exit\n    ;;\n-*) echo >&2 \"$usage\"; exit 1 ;;\n+*) usage ;;\n esac\n \n # Note that these list commits in reverse order;\n-- \n0.99.9.GIT\n"},{"id":"13588","messageId":"11345130322374-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 9/11] git-prune: Usage string clean-up, use the 'usage' function","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:32Z","receivedAt":"2005-12-13T22:30:32Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-prune.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\n7fb74410bb8975f547d0bae395b74ca783a5cce4\ndiff --git a/git-prune.sh b/git-prune.sh\nindex 7e7f0ad..7b61d05 100755\n--- a/git-prune.sh\n+++ b/git-prune.sh\n@@ -1,5 +1,6 @@\n #!/bin/sh\n \n+USAGE='[-n] [--] [<head>...]'\n . git-sh-setup\n \n dryrun=\n@@ -9,7 +10,7 @@ do\n     case \"$1\" in\n     -n) dryrun=-n echo=echo ;;\n     --) break ;;\n-    -*) echo >&2 \"usage: git-prune [ -n ] [ heads... ]\"; exit 1 ;;\n+    -*) usage ;;\n     *)  break ;;\n     esac\n     shift;\n-- \n0.99.9.GIT\n"},{"id":"13589","messageId":"11345130321353-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 11/11] git-repack: Usage string clean-up, emit usage at incorrect invocation","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:32Z","receivedAt":"2005-12-13T22:30:32Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-repack.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\n8b8f12ef2bdb33a0695a82c9f7a4f4eed112ad25\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 430ddc5..1fafb6e 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -3,6 +3,7 @@\n # Copyright (c) 2005 Linus Torvalds\n #\n \n+USAGE='[-a] [-d] [-l] [-n]'\n . git-sh-setup\n \t\n no_update_info= all_into_one= remove_redundant= local=\n@@ -13,7 +14,7 @@ do\n \t-a)\tall_into_one=t ;;\n \t-d)\tremove_redundant=t ;;\n \t-l)\tlocal=t ;;\n-\t*)\tbreak ;;\n+\t*)\tusage ;;\n \tesac\n \tshift\n done\n-- \n0.99.9.GIT\n"},{"id":"13590","messageId":"11345130323512-git-send-email-freku045@student.liu.se","threadId":"2826","inReplyTo":"11345130302438-git-send-email-freku045@student.liu.se","subject":"[PATCH 10/11] git-rebase: Usage string clean-up, emit usage string at incorrect invocation","fromName":"","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-13T22:30:32Z","receivedAt":"2005-12-13T22:30:32Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n---\n\n git-rebase.sh |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ne5739c10c7fb47d091cf774941da6e4b4629f350\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 638ff0d..8a5f44a 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,6 +3,7 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n+USAGE='<upstream> [<head>]'\n . git-sh-setup\n \n # Make sure we do not have .dotest\n@@ -19,7 +20,7 @@ you still have something valuable there.\n fi\n \n # The other head is given.  Make sure it is valid.\n-other=$(git-rev-parse --verify \"$1^0\") || exit\n+other=$(git-rev-parse --verify \"$1^0\") || usage\n \n # Make sure we have HEAD that is valid.\n head=$(git-rev-parse --verify \"HEAD^0\") || exit\n@@ -36,7 +37,7 @@ esac\n # If the branch to rebase is given, first switch to it.\n case \"$#\" in\n 2)\n-\tgit-checkout \"$2\" || exit\n+\tgit-checkout \"$2\" || usage\n esac\n \n # If the HEAD is a proper descendant of $other, we do not even need\n-- \n0.99.9.GIT\n"},{"id":"13607","messageId":"7vfyow45l2.fsf@assigned-by-dhcp.cox.net","threadId":"2826","inReplyTo":"11345130311492-git-send-email-freku045@student.liu.se","subject":"Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-14T05:20:57Z","receivedAt":"2005-12-14T05:20:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"freku045@student.liu.se writes:\n\n>  . git-sh-setup\n>  \n> +[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n> +\n\nI do not see much advantage to use [[...]] construct here.\n\n\thttp://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_04\n\ntalks about [[ ... ]] being \"some implementations causing\nunspecified results\".\n"},{"id":"13618","messageId":"20051214144542.0a509e3e.tihirvon@gmail.com","threadId":"2826","inReplyTo":"7vfyow45l2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2005-12-14T12:45:42Z","receivedAt":"2005-12-14T12:45:42Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"On Tue, 13 Dec 2005 21:20:57 -0800\nJunio C Hamano <junkio@cox.net> wrote:\n\n> freku045@student.liu.se writes:\n> \n> >  . git-sh-setup\n> >  \n> > +[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n> > +\n> \n> I do not see much advantage to use [[...]] construct here.\n\n[[ ]] is bashishm. Does not work with ash.\n\n\ntest $# -ge 3 && test $# -le 4 || usage\n\nYou don't need to quote $# because it is always defined (and always\nnon-negative integer).  You can't unset or set it.\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"13698","messageId":"20051215195528.GA14388@c165.ib.student.liu.se","threadId":"2826","inReplyTo":"20051214144542.0a509e3e.tihirvon@gmail.com","subject":"Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"Fredrik Kuivinen","fromEmail":"freku045@student.liu.se","sentAt":"2005-12-15T19:55:28Z","receivedAt":"2005-12-15T19:55:28Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"On Wed, Dec 14, 2005 at 02:45:42PM +0200, Timo Hirvonen wrote:\n> On Tue, 13 Dec 2005 21:20:57 -0800\n> Junio C Hamano <junkio@cox.net> wrote:\n> \n> > freku045@student.liu.se writes:\n> > \n> > >  . git-sh-setup\n> > >  \n> > > +[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n> > > +\n> > \n> > I do not see much advantage to use [[...]] construct here.\n> \n> [[ ]] is bashishm. Does not work with ash.\n> \n> \n> test $# -ge 3 && test $# -le 4 || usage\n> \n> You don't need to quote $# because it is always defined (and always\n> non-negative integer).  You can't unset or set it.\n\nThanks. I guess this is what happens when you try to learn sh\nprogramming from the bash manpage. :)\n\n- Fredrik\n"},{"id":"13699","messageId":"43A1D24B.5070603@gmail.com","threadId":"2826","inReplyTo":"20051215195528.GA14388@c165.ib.student.liu.se","subject":"Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2005-12-15T20:30:03Z","receivedAt":"2005-12-15T20:30:03Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"Fredrik Kuivinen wrote:\n> On Wed, Dec 14, 2005 at 02:45:42PM +0200, Timo Hirvonen wrote:\n> \n>>On Tue, 13 Dec 2005 21:20:57 -0800\n>>Junio C Hamano <junkio@cox.net> wrote:\n>>\n>>\n>>>freku045@student.liu.se writes:\n>>>\n>>>\n>>>> . git-sh-setup\n>>>> \n>>>>+[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n>>>>+\n>>>\n>>>I do not see much advantage to use [[...]] construct here.\n>>\n>>[[ ]] is bashishm. Does not work with ash.\n>>\n>>\n>>test $# -ge 3 && test $# -le 4 || usage\n>>\n>>You don't need to quote $# because it is always defined (and always\n>>non-negative integer).  You can't unset or set it.\n> \n> \n\nThis patch seems not working for me:\n\n$ git-applymbox -k 0001-JUST-A-TEST.txt\n1 patch(es) to process.\nUsage: /home/marco/bin/git-applypatch <msg> <patch> <info> [<signoff>]\n\n\nwhere\n\n$ cat 0001-JUST-A-TEST.txt\n From nobody Mon Sep 17 00:00:00 2001\nSubject: [PATCH] JUST A TEST\nFrom: Marco Costalba <mcostalba@gmail.com>\nDate: 1134677832 +0100\n\n---\n\n  git-applypatch.sh |    2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n\nee8ea125fd2b0598e26e1556210abb9d0edc459a\ndiff --git a/git-applypatch.sh b/git-applypatch.sh\nindex e8ba34a..26b4cba 100755\n--- a/git-applypatch.sh\n+++ b/git-applypatch.sh\n@@ -10,7 +10,7 @@\n  ##     $3 - \"info\" file with Author, email and subject\n  ##     $4 - optional file containing signoff to add\n  ##\n-\n+## JUST A TEST\n  USAGE='<msg> <patch> <info> [<signoff>]'\n  . git-sh-setup\n\n--\n0.99.9.GIT\n\n\nThe offending patch is\n\nAuthor: Junio C Hamano <junkio@cox.net>\nDate:   14/12/2005 03:19:12\nParent: git-repack: Usage string clean-up, emit usage at incorrec...\n\n    applypatch: no need to do non-portable [[ ... ]]\n\n\n    ... when old, proven, case would do.\n\n    Signed-off-by: Junio C Hamano <junkio@cox.net>\n\n--- a/git-applypatch.sh\n+++ b/git-applypatch.sh\n@@ -14,7 +14,7 @@\n  USAGE='<msg> <patch> <info> [<signoff>]'\n  . git-sh-setup\n\n-[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n+case \"$#\" in 3|4) usage ;; esac\n\n  final=.dotest/final-commit\n  ##\n\n\nreverting the patch everything works fine.\n\nMarco\n"},{"id":"13700","messageId":"7v64pqozwd.fsf@assigned-by-dhcp.cox.net","threadId":"2826","inReplyTo":"43A1D24B.5070603@gmail.com","subject":"Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-15T20:42:42Z","receivedAt":"2005-12-15T20:42:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n> This patch seems not working for me:\n>\n> -[[ \"$#\" = \"3\" || \"$#\" = \"4\" ]] || usage\n> +case \"$#\" in 3|4) usage ;; esac\n\nI am an idiot.  Thanks.  That should have read \"3|4) ;; *)\nusage\", obviously.\n"}]}