本文介绍了git计算文件哈希如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
存储在树对象中的SHA1哈希(由 git ls-tree 返回)与文件内容的SHA1哈希值不匹配(由<$ c返回 $ b
The SHA1 hashes stored in the tree objects (as returned by git ls-tree) do not match the SHA1 hashes of the file content (as returned by sha1sum)
$ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sum de20247992af0f949ae8df4fa9a37e4a03d7063e -git计算文件散列如何?它在计算哈希之前是否压缩内容?
How does git compute file hashes? Does it compress the content before computing the hash?
推荐答案
Git用blob ,然后是长度(作为人类可读的整数),后面跟着一个NUL字符
$ echo -e'blob 14 \0你好,世界!'| shasum 8ab686eafeb1f44702738c8b0f24f2567c36da6d
来源: alblue.bandlem/2011/08/git-tip-of-week-objects.html
更多推荐
git计算文件哈希如何?
发布评论