diff options
Diffstat (limited to 'cmd_command.go')
-rw-r--r-- | cmd_command.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd_command.go b/cmd_command.go index 814c06e..a6300b5 100644 --- a/cmd_command.go +++ b/cmd_command.go @@ -149,7 +149,8 @@ func (CmdCommitEnd) fiCmdRead(fir fiReader) (Cmd, error) { panic("not reached") // Hint: Use CmdReset to create a *lightweight* tag. type CmdTag struct { RefName string - Mark int // optional; < 1 for non-use + Mark int // optional; < 1 for non-use + Name string // optional CommitIsh string OriginalOID string // optional Tagger Ident @@ -164,6 +165,9 @@ func (c CmdTag) fiCmdWrite(fiw fiWriter) error { if c.Mark > 0 { ez.WriteMark(c.Mark) } + if c.Name != "" { + ez.WriteLine("name", c.Name) + } ez.WriteLine("from", c.CommitIsh) if c.OriginalOID != "" { ez.WriteLine("original-oid", c.OriginalOID) @@ -187,6 +191,11 @@ func (CmdTag) fiCmdRead(fir fiReader) (cmd Cmd, err error) { ez.Errcheck(err) } + // ('name' SP <name> LF)? + if strings.HasPrefix(ez.PeekLine(), "name ") { + c.Name = trimLinePrefix(ez.ReadLine(), "name ") + } + // 'from' SP <commit-ish> LF if !strings.HasPrefix(ez.PeekLine(), "from ") { ez.Errcheck(errors.Errorf("tag: expected from command: %q", ez.ReadLine())) |