Git 将单个对象存储在 .git/objects/ab/cdefgh...
中,其中 ab
是 SHA1 摘要的第一个字节。
但是,包文件不遵循相同的命名策略,而且我找不到关于它是如何命名的文档。有什么见解吗?
最佳答案
包文件保存在 objects/pack
中,记录在 gitrepository layout 中.在此目录中,它们以索引文件和包文件本身的形式存储,例如:
pack-a862cfa8b080773290073999c800a2e655ef9b5d.idx
pack-a862cfa8b080773290073999c800a2e655ef9b5d.pack
这些文件名中的 SHA1sum 是如何计算的,在 git-pack-objects 中有解释。文档(我的重点):
Write into a pair of files (.pack and .idx), using <base-name> to determine the name of the created file. When this option is used, the two files are written in <base-name>-<SHA1>.<pack,idx> files. <SHA1> is a hash of the sorted object names to make the resulting filename based on the pack content, and written to the standard output of the command.
object names是包文件中对象的 SHA1 和。
关于Git pack 文件名——摘要是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5469978/