diff options
-rw-r--r-- | cmd.go | 2 | ||||
-rw-r--r-- | cmd_command.go | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -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 <encoding> LF)? + if strings.HasPrefix(ez.PeekLine(), "encoding ") { + c.Encoding = trimLinePrefix(ez.ReadLine(), "encoding ") + } + // data c.Msg, err = parse_data(ez.ReadLine()) ez.Errcheck(err) |