Git -cat-file output

When I run git cat-file -batch in commit, it returns "missing ...", but the commit exists. Why could this happen? When the cat file was run with the -t switch, it simply displayed "commit", as I expected. Can anyone explain this? I am new to git. Thank.

EDIT: I figured out the reason. msysgit expects LF , and ENTER generates CRLF .

+3
source share
1 answer

I'm not sure it should work as you mentioned in your question. (Perhaps after git 2.8, March 2016, see below) git cat-file --batch

GitMagic ", unix, git cat-file sinelaw :

, , :

$ echo 05b217bb859794d08bb9e4f7f04cbda4b207fbe9 | git cat-file --batch

OP Alex.Shen, newline:
git LF (Line Feed, U + 000A) Windows CRLF ( CR + LF: CR (U + 000D), LF (U + 000A)).
| ' EOL bash msysgit (LF), .


: git 2.5+ (Q2 2015) git cat-file --batch.
( git github.com/git-for-windows/git/releases)

. commit 122d534 (csusbdt), 20 2015 .
( Junio ​​C Hamano - gitster - 67f0b6f, 01 2015 .)

cat-file: --follow-symlinks --batch

"git cat-file --batch(-check)" "--follow-symlinks", ​​, SHA-1.

. HEAD:RelNotes, Documentation/RelNotes/2.5.0.txt.

, HEAD:Documentation/RelNotes/2.5.0.txt.


2016 :

Git 2.8 CRLF git:

. a551843, 933bea9, commit 1536dd9, commit b42ca3d, commit 692dfdf, 3f16396, commit 18814d0, commit 1f3b1ef, commit 72e37b6, commit 6e8d46f, commit c0353c7 (28 2015 .) Junio ​​C Hamano (gitster).
( Junio ​​C Hamano - gitster - 0175655, 03 2016 .)

, commit b42ca3d strbuf.c#strbuf_getline() ( , LF NUL )

git 2.8:

cat-file: strbuf_getline()

DOS .

+3

Source: https://habr.com/ru/post/1785367/


All Articles