Re: [PATCH 3/8] Better Error Handling for add

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

 



greened@xxxxxxxxxxxxx writes:

>> If you want to make sure you give a comit to add_commit, you can
>> probably say something like this:
>>
>> 	git rev-parse -q --verify "$1^{commit}" >/dev/null ||
>>         die "'$1' does not refer to a commit"
>
> What does $1^{commit} mean?

"$thing^{type}" tells Git to interpret the $thing as that type (and
error out if it can't).

So v1.0.0^{commit} is a less cryptic way to say v1.0.0^0 (there is
no need to say "zeroth parent of a commit is the commit itself?
Yeah, it makes sort of sense" when you learn it).

"git cat-file -t junio-gpg-pub^{blob}" will say "blob", but you will
get a failure from "git rev-parse v1.0.0^{blob}" as you can only
dereference a tag that refers to a commit down to the comit and then
to its top-level tree, but not to a single blob.

And you can ask for the tree object with v1.0.0^{tree}, for example.

        
--
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]