我注意到在 git 版本1.8.3.1
(由 CentOS 7 提供)中,这个命令似乎不起作用:
git cat-file -t -- "5378198ea7a83f5fa9bb3ba17f51be3a6ffbecc1:README.md"
(显然指定正确的 git 散列和该版本的现有文件)
这是标准错误:
usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
or: git cat-file (--batch|--batch-check) < <list_of_objects>
<type> can be one of: blob, tree, commit, tag
-t show object type
-s show object size
-e exit with zero when there's no error
-p pretty-print object's content
--textconv for blob objects, run textconv on object's content
--batch show info and content of objects fed from the standard input
--batch-check show info about objects fed from the standard input
对我来说,问题似乎是“ --
”转义参数被解释为一种类型而不是连续参数的转义。事实上,这对我有用:
git cat-file -t "5378198ea7a83f5fa9bb3ba17f51be3a6ffbecc1:README.md"
它存在并0
具有以下结果:
blob
所以,简而言之。
问题
您建议如何继续发现--
git 中引入“”参数的时间?
相关文件:
git cat-file
曾经严格检查它的参数数量,这意味着--
不能使用。检查发生在选项被解析之前,这就是为什么您会立即获得用法输出,而没有指示为什么参数无效的原因。这已于2015 年 5 月删除;包含此更改的第一个版本是 2.5.0。
为了弄清楚这一点,我将
cat-file.c
1.8.3.1 版本与其当前状态进行了比较;我注意到对参数版本的检查,然后查找删除它的提交。