You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am learning about the git object storage recently. I tried to use the compress/zlib to implment the git hash-object command, the snippet of exmple code could be found at https://go.dev/play/p/_a_CGxRHTcy. The compress data will be write to the .git/objects/[ref-header]/[ref-body].
What did you expect to see?
The content of git object can be displayed as: git cat-file -p [some digest].
What did you see instead?
The content could not be read by git:
git cat-file -p e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
fatal: unable to stream e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 to stdout
The underlying compression format is RFC 1951. The Go implementation only guarantees that it produces valid output that is compatible with RFC 1951, but does not guarantee that it outputs any specific sequence of bits.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am learning about the git object storage recently. I tried to use the
compress/zlib
to implment thegit hash-object
command, the snippet of exmple code could be found at https://go.dev/play/p/_a_CGxRHTcy. The compress data will be write to the.git/objects/[ref-header]/[ref-body]
.What did you expect to see?
The content of git object can be displayed as:
git cat-file -p [some digest]
.What did you see instead?
The content could not be read by git:
The content compress by
compress/zlib
was:I tried to decompress and recompress the content like this:
The output is now be the same with
git hash-object
does.I have tried with compress level from 1 to 9 of the
compress/zlib
lib, but none of them can produce785e 4bca c94f 5230 6000 0009 b001 f0
I am not familiar with the zlib algo, can any one be kind to help me out? Thanks in advance!
The text was updated successfully, but these errors were encountered: