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

[PATCH] fix cat-file usage message and documentation

From
Jeff King <peff@peff.net>
Date
May 25, 2009, 10:33 UTC
Message-ID
<20090525103315.GA26263@coredump.intra.peff.net>

cat-file with an object on the command line requires an option to tell it what to output (type, size, pretty-print, etc). However, the square brackets in the usage imply that those options are not required. This patch switches them to parentheses to indicate "required but grouped-OR" (curly braces might also work, but this follows the convention used already by "git stash").

While we're at it, let's change the <sha1> specifier in the usage to <object>. That's what the documentation uses, and it does actually use the regular object lookup.

Signed-off-by: Jeff King <peff@peff.net>
---
This is a followup to:
  http://thread.gmane.org/gmane.comp.version-control.git/116627
 Documentation/git-cat-file.txt |    4 ++--
 builtin-cat-file.c             |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index b191276..58c8d65 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -9,8 +9,8 @@ git-cat-file - Provide content or type and size information for repository objec
 SYNOPSIS
 --------
 [verse]
-'git cat-file' [-t | -s | -e | -p | <type>] <object>
-'git cat-file' [--batch | --batch-check] < <list-of-objects>
+'git cat-file' (-t | -s | -e | -p | <type>) <object>
+'git cat-file' (--batch | --batch-check) < <list-of-objects>
 
 DESCRIPTION
 -----------
diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index 8fad19d..43ffe7f 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -201,8 +201,8 @@ static int batch_objects(int print_contents)
 }
 
 static const char * const cat_file_usage[] = {
-	"git cat-file [-t|-s|-e|-p|<type>] <sha1>",
-	"git cat-file [--batch|--batch-check] < <list_of_sha1s>",
+	"git cat-file (-t|-s|-e|-p|<type>) <object>",
+	"git cat-file (--batch|--batch-check) < <list_of_objects>",
 	NULL
 };
 
-- 
1.6.3.1.250.g01b8b.dirty
Message 1 of 1 in “fix cat-file usage message and documentation”
  1. fix cat-file usage message and documentationJeff King, May 25, 2009

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.