git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] git-diff: Usage string clean-up

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Dec 15, 2005, 22:47 UTC
Message-ID
<20051215224757.GC14388@c165.ib.student.liu.se>
In-Reply-To
<20051215224350.GB14388@c165.ib.student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
 git-diff.sh |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
ca73d87d08c8c3702495694cc1080112c4c34ba1
diff --git a/git-diff.sh b/git-diff.sh
index b62e583..4812ae4 100755
--- a/git-diff.sh
+++ b/git-diff.sh
@@ -3,15 +3,14 @@
 # Copyright (c) 2005 Linus Torvalds
 # Copyright (c) 2005 Junio C Hamano
 
+USAGE='[ --diff-options ] <ent>{0,2} [<path>...]'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
 rev=$(git-rev-parse --revs-only --no-flags --sq "$@") || exit
 flags=$(git-rev-parse --no-revs --flags --sq "$@")
 files=$(git-rev-parse --no-revs --no-flags --sq "$@")
 
-die () {
-    echo >&2 "$*"
-    exit 1
-}
-
 # I often say 'git diff --cached -p' and get scolded by git-diff-files, but
 # obviously I mean 'git diff --cached -p HEAD' in that case.
 case "$rev" in
@@ -40,8 +39,7 @@ esac
 
 case "$rev" in
 ?*' '?*' '?*)
-	echo >&2 "I don't understand"
-	exit 1
+	usage
 	;;
 ?*' '^?*)
 	begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
@@ -58,7 +56,7 @@ case "$rev" in
 	cmd="git-diff-files $flags -- $files"
 	;;
 *)
-	die "I don't understand $*"
+	usage
 	;;
 esac
 
-- 
0.99.9.GIT
Previous: Fredrik KuivinenNext: Fredrik Kuivinen
Message 2 of 4 in “Usage string clean-up (diff, log and whatchanged)”
  1. 0/3 Usage string clean-up (diff, log and whatchanged)Fredrik Kuivinen, Dec 15, 2005
  2. 1/3 git-diff: Usage string clean-upFredrik Kuivinen, Dec 15, 2005
  3. 2/3 git-log: Add usage stringFredrik Kuivinen, Dec 15, 2005
  4. 3/3 git-whatchanged: Add usage stringFredrik Kuivinen, Dec 15, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.