summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd_command.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/cmd_command.go b/cmd_command.go
index 14fd2e9..d66c9ce 100644
--- a/cmd_command.go
+++ b/cmd_command.go
@@ -38,11 +38,14 @@ type CmdCommit struct {
OriginalOID string // optional
Author *Ident
Committer Ident
- GPGSig string // optional
- Encoding string // optional
- Msg string
- From string
- Merge []string
+ GPGSig struct { // optional
+ Alg string
+ Sig string
+ }
+ Encoding string // optional
+ Msg string
+ From string
+ Merge []string
}
func (c CmdCommit) fiCmdClass() cmdClass { return cmdClassCommand }
@@ -60,9 +63,9 @@ func (c CmdCommit) fiCmdWrite(fiw fiWriter) error {
ez.WriteLine("author", *c.Author)
}
ez.WriteLine("committer", c.Committer)
- if c.GPGSig != "" {
- ez.WriteLine("gpgsig")
- ez.WriteData(c.GPGSig)
+ if c.GPGSig.Alg != "" {
+ ez.WriteLine("gpgsig", c.GPGSig.Alg)
+ ez.WriteData(c.GPGSig.Sig)
}
if c.Encoding != "" {
ez.WriteLine("encoding", c.Encoding)
@@ -110,10 +113,10 @@ func (CmdCommit) fiCmdRead(fir fiReader) (cmd Cmd, err error) {
c.Committer, err = ParseIdent(trimLinePrefix(ez.ReadLine(), "committer "))
ez.Errcheck(err)
- // ('gpgsig' LF data)?
- if ez.PeekLine() == "gpgsig\n" {
- ez.ReadLine()
- c.GPGSig, err = parse_data(ez.ReadLine())
+ // ('gpgsig' SP <alg> LF data)?
+ if strings.HasPrefix(ez.PeekLine(), "gpgsig ") {
+ c.GPGSig.Alg = trimLinePrefix(ez.ReadLine(), "gpgsig ")
+ c.GPGSig.Sig, err = parse_data(ez.ReadLine())
ez.Errcheck(err)
}