【发布时间】:2020-06-21 18:54:32
【问题描述】:
我正在尝试使用自定义解决方案来连接到 git API,当我对以字母开头的内容进行 shasum 时,结果匹配:
$ echo -e -n "blob 4\0test" | shasum
30d74d258442c7c65512eafab474568dd706c430 *-
$ echo -e -n "test" | git hash-object --stdin
30d74d258442c7c65512eafab474568dd706c430
但内容以数字开头时不匹配:
$ echo -e -n "blob 5\0test" | shasum
315a7861230f24fade469e87c0c548f0cc4bc8c8 *-
$ echo -e -n "0test" | git hash-object --stdin
475a3cf5e5dadf80fe51cc8748c9bfdabae29f07
我很困惑为什么它会给出不同的结果,有人知道为什么会这样吗?
【问题讨论】: