From 08829058a1d436a2c2fb9cee88ef13a3d30ae3d4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 1 Feb 2021 17:49:52 -0700 Subject: Bring up to git.git commit 3edfcc65fdfc708c1c8f1d314885eecf9beb9b67 --- cmd.go | 2 +- cmd_command.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd.go b/cmd.go index 7582b47..7b7e122 100644 --- a/cmd.go +++ b/cmd.go @@ -27,7 +27,7 @@ // A program can read commands from a frontend by wrapping the // appropriate io.Reader with a Frontend object. // -// This is up-to-date with full syntax supported by git v2.22.0. +// This is up-to-date with full syntax supported by git v2.23.0. package libfastimport type fiReader interface { diff --git a/cmd_command.go b/cmd_command.go index e68a3b1..a326524 100644 --- a/cmd_command.go +++ b/cmd_command.go @@ -38,6 +38,7 @@ type CmdCommit struct { OriginalOID string // optional Author *Ident Committer Ident + Encoding string // optional Msg string From string Merge []string @@ -58,6 +59,9 @@ func (c CmdCommit) fiCmdWrite(fiw fiWriter) error { ez.WriteLine("author", *c.Author) } ez.WriteLine("committer", c.Committer) + if c.Encoding != "" { + ez.WriteLine("encoding", c.Encoding) + } ez.WriteData(c.Msg) if c.From != "" { ez.WriteLine("from", c.From) @@ -101,6 +105,11 @@ func (CmdCommit) fiCmdRead(fir fiReader) (cmd Cmd, err error) { c.Committer, err = ParseIdent(trimLinePrefix(ez.ReadLine(), "committer ")) ez.Errcheck(err) + // ('encoding' SP LF)? + if strings.HasPrefix(ez.PeekLine(), "encoding ") { + c.Encoding = trimLinePrefix(ez.ReadLine(), "encoding ") + } + // data c.Msg, err = parse_data(ez.ReadLine()) ez.Errcheck(err) -- cgit v1.2.3-54-g00ecf