Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Reading commit objects

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:24

Chico Sokol [off-list ref] writes:
Hello,

I'm building a library to manipulate git repositories (interacting
directly with the filesystem).

Currently, we're trying to parse commit objects. After decompressing
the contents of a commit object file we got the following output:
Who wrote this commit object you are trying to read?  Us, or your
library (this question is to see if you are chasing the right
problem)?
commit 191
author Francisco Sokol [off-list ref] 1369140112 -0300
committer Francisco Sokol [off-list ref] 1369140112 -0300

first commit

We hoped to get the same output of a "git cat-file -p <sha1>", but
that didn't happened. From a commit object, how can I find tree object
hash of this commit?
If you care about the byte-for-byte compatibility, never use
"cat-file -p".  That is meant for human consumption.

"git cat-file commit <sha1>" gives you the raw representation after
inflating and stripping out the first "<type> SP <length> LF" line.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help