From b7bd3adf84ed5f5c18b659973a0539d611a61230 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 1 Feb 2021 17:37:34 -0700 Subject: Bring up to git.git commit 7ffde293f2e7f0ae455800b138416da601254436 --- cmd_comment.go | 10 +++++++++- frontend.go | 8 +++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cmd_comment.go b/cmd_comment.go index a6d8c9e..8c812f4 100644 --- a/cmd_comment.go +++ b/cmd_comment.go @@ -83,7 +83,15 @@ type CmdCatBlob struct { DataRef string } -func (c CmdCatBlob) fiCmdClass() cmdClass { return cmdClassComment } +func (c CmdCatBlob) fiCmdClass() cmdClass { + // Prior to git v2.22.0 this was 'cmdClassComment', but in + // v2.22.0 it was changed to a stricter + // 'cmdClassCommand|cmdClassInCommit|cmdClassInFileModify'. I + // don't want to implement cmdClassInFileModify for just this + // one command, and also I want to have better backward + // compatibility; so I'm keeping it as 'cmdClassComment'. + return cmdClassComment +} func (c CmdCatBlob) fiCmdWrite(fiw fiWriter) error { return fiw.WriteLine("cat-blob", c.DataRef) } diff --git a/frontend.go b/frontend.go index f449179..5ae6bd9 100644 --- a/frontend.go +++ b/frontend.go @@ -38,9 +38,11 @@ func (e UnsupportedCommand) Error() string { // RespondCatBlob, and RespondLs methods actually write information; // it isn't a read-only object. // -// The parser is a bit more forgiving than git's own parser; it allows -// extra newlines anywhere it allows comments, whereas git's own -// parser is quite strict about newlines. +// The parser is a bit more forgiving than git's own parser. It +// allows extra newlines anywhere it allows comments, whereas git's +// own parser is quite strict about newlines. It allows 'cat-blob' +// commands anywhere it allows comments, which git used to allow, but +// was made stricter in git v2.22.0. type Frontend struct { fastImport *parser catBlobWrite *textproto.CatBlobWriter -- cgit v1.2.3