All of lore.kernel.org
 help / color / mirror / Atom feed
* "git cat-file <sha1>" shows usage but should not?
@ 2009-04-15 16:50 Sebastian Pipping
  2009-04-15 16:54 ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Pipping @ 2009-04-15 16:50 UTC (permalink / raw)
  To: git

Here is what I did:


$ git cat-file -t b8c11fbbffbe171c4960058fa2d96f708e57a80c
commit

$ git cat-file b8c11fbbffbe171c4960058fa2d96f708e57a80c
usage: git cat-file [-t|-s|-e|-p|<type>] <sha1>
   or: git cat-file [--batch|--batch-check] < <list_of_sha1s>
[..]

$ git --version
git version 1.6.3.rc0.1.gf800.dirty



Sebastian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 16:50 "git cat-file <sha1>" shows usage but should not? Sebastian Pipping
@ 2009-04-15 16:54 ` Jeff King
  2009-04-15 16:56   ` Sebastian Pipping
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2009-04-15 16:54 UTC (permalink / raw)
  To: Sebastian Pipping; +Cc: git

On Wed, Apr 15, 2009 at 06:50:47PM +0200, Sebastian Pipping wrote:

> Here is what I did:
> 
> $ git cat-file -t b8c11fbbffbe171c4960058fa2d96f708e57a80c
> commit
> 
> $ git cat-file b8c11fbbffbe171c4960058fa2d96f708e57a80c
> usage: git cat-file [-t|-s|-e|-p|<type>] <sha1>
>    or: git cat-file [--batch|--batch-check] < <list_of_sha1s>
> [..]

That usage message is misleading. You need to use one of -t, -s, -e, -p,
or <type>. So it should perhaps just be:

  git cat-file -t|-s|-e|-p|<type> <sha1>

though that looks terribly ugly. Suggestions welcome.

-Peff

P.S. Depending on what you're trying to accomplish, "git show <sha1>"
     may be a better choice.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 16:54 ` Jeff King
@ 2009-04-15 16:56   ` Sebastian Pipping
  2009-04-15 17:04     ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Pipping @ 2009-04-15 16:56 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Jeff King wrote:
> That usage message is misleading. You need to use one of -t, -s, -e, -p,
> or <type>. So it should perhaps just be:
> 
>   git cat-file -t|-s|-e|-p|<type> <sha1>
> 
> though that looks terribly ugly. Suggestions welcome.

Thanks for making that clear.  How about round or curly brackets?



Sebastian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 16:56   ` Sebastian Pipping
@ 2009-04-15 17:04     ` Jeff King
  2009-04-15 17:18       ` Junio C Hamano
  2009-04-15 17:33       ` Julian Phillips
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff King @ 2009-04-15 17:04 UTC (permalink / raw)
  To: Sebastian Pipping; +Cc: Junio C Hamano, git

On Wed, Apr 15, 2009 at 06:56:05PM +0200, Sebastian Pipping wrote:

> Jeff King wrote:
> > That usage message is misleading. You need to use one of -t, -s, -e, -p,
> > or <type>. So it should perhaps just be:
> > 
> >   git cat-file -t|-s|-e|-p|<type> <sha1>
> > 
> > though that looks terribly ugly. Suggestions welcome.
> 
> Thanks for making that clear.  How about round or curly brackets?

I think curly makes the most sense for grouping, though I still think it
is a bit ugly. Patch is below.

-- >8 --
Subject: [PATCH] fix cat-file usage message and documentation

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
curly braces to indicate "required but grouped-OR".

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.
---
The curly braces seem to render fine via asciidoc (presumably because
there is no entity with that name), but I'm not sure if that will work
with all asciidoc versions.

 Documentation/git-cat-file.txt |    2 +-
 builtin-cat-file.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index b191276..0856568 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -9,7 +9,7 @@ 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' {-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..4e6ad73 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.rc0.156.g19ef8

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 17:04     ` Jeff King
@ 2009-04-15 17:18       ` Junio C Hamano
  2009-04-15 17:34         ` Jeff King
  2009-04-15 17:33       ` Julian Phillips
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-04-15 17:18 UTC (permalink / raw)
  To: Jeff King; +Cc: Sebastian Pipping, git

Jeff King <peff@peff.net> writes:

> On Wed, Apr 15, 2009 at 06:56:05PM +0200, Sebastian Pipping wrote:
>
>> Jeff King wrote:
>> > That usage message is misleading. You need to use one of -t, -s, -e, -p,
>> > or <type>. So it should perhaps just be:
>> > 
>> >   git cat-file -t|-s|-e|-p|<type> <sha1>
>> > 
>> > though that looks terribly ugly. Suggestions welcome.
>> 
>> Thanks for making that clear.  How about round or curly brackets?
>
> I think curly makes the most sense for grouping, though I still think it
> is a bit ugly. Patch is below.

Thanks.  Doesn't this remind us of $gmane/72243, by the way?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 17:04     ` Jeff King
  2009-04-15 17:18       ` Junio C Hamano
@ 2009-04-15 17:33       ` Julian Phillips
  2009-04-15 17:36         ` Jeff King
  1 sibling, 1 reply; 8+ messages in thread
From: Julian Phillips @ 2009-04-15 17:33 UTC (permalink / raw)
  To: Jeff King; +Cc: Sebastian Pipping, Junio C Hamano, git

On Wed, 15 Apr 2009, Jeff King wrote:

> 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>",

Shouldn't that read:

+	"git cat-file {--batch|--batch-check} < <list_of_objects>",

since, like the previous line, you are required to supply one of the two 
options?

-- 
Julian

  ---
DPRINTK("FAILURE, CAPUT\n");
         linux-2.6.6/drivers/net/tokenring/ibmtr.c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 17:18       ` Junio C Hamano
@ 2009-04-15 17:34         ` Jeff King
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2009-04-15 17:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sebastian Pipping, git

On Wed, Apr 15, 2009 at 10:18:40AM -0700, Junio C Hamano wrote:

> > I think curly makes the most sense for grouping, though I still think it
> > is a bit ugly. Patch is below.
> 
> Thanks.  Doesn't this remind us of $gmane/72243, by the way?

Ah, yes. I felt like we had dealt with this before, but I couldn't
remember for what.

That message indicates that {} is preferred to (). Interestingly,
though, the stash usage and documentation still uses ().

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "git cat-file <sha1>" shows usage but should not?
  2009-04-15 17:33       ` Julian Phillips
@ 2009-04-15 17:36         ` Jeff King
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2009-04-15 17:36 UTC (permalink / raw)
  To: Julian Phillips; +Cc: Sebastian Pipping, Junio C Hamano, git

On Wed, Apr 15, 2009 at 06:33:10PM +0100, Julian Phillips wrote:

> On Wed, 15 Apr 2009, Jeff King wrote:
>
>> 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>",
>
> Shouldn't that read:
>
> +	"git cat-file {--batch|--batch-check} < <list_of_objects>",
>
> since, like the previous line, you are required to supply one of the two  
> options?

Oops, yes, it should.

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-15 17:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-15 16:50 "git cat-file <sha1>" shows usage but should not? Sebastian Pipping
2009-04-15 16:54 ` Jeff King
2009-04-15 16:56   ` Sebastian Pipping
2009-04-15 17:04     ` Jeff King
2009-04-15 17:18       ` Junio C Hamano
2009-04-15 17:34         ` Jeff King
2009-04-15 17:33       ` Julian Phillips
2009-04-15 17:36         ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.