如何诊断git cat文件声称对象丢失?

时间:2019-03-04 22:43:08

标签: git macos

我想在git中查看blob的内容,但看不到。我可以检查什么?

$ ls -l .git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b
-r--r--r--  1 shauncutts  staff  2351 Jan  7 17:32 .git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b
$ echo .git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b | git cat-file --batch
.git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b missing
$ git --version
git version 2.17.2 (Apple Git-113)

自制git也会发生这种情况:

$ echo .git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b | /usr/local/bin/git cat-file --batch
.git/objects/25/8f90d906f3c9c9b802042d33eb13d406d60f8b missing
$ /usr/local/bin/git --version
git version 2.21.0

1 个答案:

答案 0 :(得分:2)

对象名称是哈希码,而不是有时用来保存其内容的路径名。

git cat-file --batch <<<258f90d906f3c9c9b802042d33eb13d406d60f8b