Re: [PATCH 3/3] Teach cat-file a --quiet option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes:

> What's also annoying is cat-file today prints an error with -e if
> you use the "branch:path" syntax, but not if you supply the 40 byte
> hex SHA-1 of the blob in question.

I _think_ the intent of -e or any other "silently check" option
is to signal "status" with exit code, while still indicating an
error with the message.

For the particular example of "cat-file -e", whose purpose is to
accept an object name string and report if such an object exists
in the repository:

	$ git cat-file -e 45354a57ee7e3e42c7137db6c94fa968c6babe8d; echo $?
        0
	$ git cat-file -e 45354a57ee7e3e42c7137db6c94fa968c6babe8e; echo $?
        1
	$ git cat-file -e HEAD:NO-SUCH-PATH
	fatal: Not a valid object name HEAD:NO-SUCH-PATH

The input of the above two _look_ like valid object names and
they return Ok/Bad because the user is asking "is there such an
object?".

Technically speaking, with the last case, the user did not give
a correctly formatted object name (treeish colon needs to be
followed by a path that exists in the treeish to be considered a
valid object name), so it can be argued that complaining is the
right thing to do, but that is too literal to the law and I
would agree that it probably is on the wrong side of the
borderline.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]