summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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