Re: suggested feature: someone mails me a blob, git please tell me what it is

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

 



"Mike Coleman" <tutufan@xxxxxxxxx> writes:

> It seems like it should be fairly easy, given a blob (the file), for
> git to describe what it knows about it.  For example, it could provide
> a list of commits that it's a part of, etc.  It'd be *really* nice if
> only the output of the sha1sum command on the blob were needed. 

"git cat-file -p" does almost this : given the sha1sum for a blob, it
will give the header and the content of the blob ...

> (I can't recall exactly how git's blob SHA1's are computed--maybe
> this isn't feasible.)

... but this is where it doesn't work :
http://www.kernel.org/pub/software/scm/git/docs/v1.5.0/git.html#Discussion
explains that the sha1sum used by git is the one of the blob _plus_
its header, so it's not the one you get with "sha1sum file".

But it should be possible to recompute the git sha1sum by recomputing
the magic formula sha1sum(<ascii type without space> + <space> +
<ascii decimal size> + <byte\0> + <binary object data>).

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