summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2021-04-29 19:37:54 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2021-04-29 19:37:54 -0600
commit5e4f84f2ff741d545c489f730848b498c87f18f1 (patch)
tree446cf9cd4d02a347d4feda9cd4ca592b66fdcff0
parent004ceae6370cd0054248ffb3b09c411791fde9ec (diff)
tag names v2
-rw-r--r--cmd_command.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd_command.go b/cmd_command.go
index 8c6a20a..14fd2e9 100644
--- a/cmd_command.go
+++ b/cmd_command.go
@@ -160,9 +160,9 @@ func (CmdCommitEnd) fiCmdRead(fir fiReader) (Cmd, error) { panic("not reached")
//
// Hint: Use CmdReset to create a *lightweight* tag.
type CmdTag struct {
- RefName string
+ TagName string
Mark int // optional; < 1 for non-use
- Name string // optional
+ RefName string // optional; default is "refs/tags/"+TagName
CommitIsh string
OriginalOID string // optional
Tagger Ident
@@ -173,12 +173,12 @@ func (c CmdTag) fiCmdClass() cmdClass { return cmdClassCommand }
func (c CmdTag) fiCmdWrite(fiw fiWriter) error {
ez := &ezfiw{fiw: fiw}
- ez.WriteLine("tag", c.RefName)
+ ez.WriteLine("tag", c.TagName)
if c.Mark > 0 {
ez.WriteMark(c.Mark)
}
- if c.Name != "" {
- ez.WriteLine("name", c.Name)
+ if c.RefName != "" && c.RefName != "refs/tags/"+c.TagName {
+ ez.WriteLine("refname", c.RefName)
}
ez.WriteLine("from", c.CommitIsh)
if c.OriginalOID != "" {
@@ -194,8 +194,8 @@ func (CmdTag) fiCmdRead(fir fiReader) (cmd Cmd, err error) {
ez := &ezfir{fir: fir}
defer ez.Defer(&err)
- // 'tag' SP <name> LF
- c := CmdTag{RefName: trimLinePrefix(ez.ReadLine(), "tag ")}
+ // 'tag' SP <tagname> LF
+ c := CmdTag{TagName: trimLinePrefix(ez.ReadLine(), "tag ")}
// mark?
if strings.HasPrefix(ez.PeekLine(), "mark :") {
@@ -203,9 +203,9 @@ 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 ")
+ // ('refname' SP <refname> LF)?
+ if strings.HasPrefix(ez.PeekLine(), "refname ") {
+ c.RefName = trimLinePrefix(ez.ReadLine(), "refname ")
}
// 'from' SP <commit-ish> LF