From 00160f6afe221862fdfdfab381979c8cd31daeb7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 29 Apr 2021 19:30:49 -0600 Subject: tag names v1 --- cmd_command.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 LF)? + if strings.HasPrefix(ez.PeekLine(), "name ") { + c.Name = trimLinePrefix(ez.ReadLine(), "name ") + } + // 'from' SP LF if !strings.HasPrefix(ez.PeekLine(), "from ") { ez.Errcheck(errors.Errorf("tag: expected from command: %q", ez.ReadLine())) -- cgit v1.2.3-2-g168b