-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tag commit message #21693
Fix tag commit message #21693
Changes from all commits
7469bc2
5dcc580
a8d5ba6
fa4cd7d
c8f6cc4
6fbafb3
d2965fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ func (repo *Repository) getCommitFromBatchReader(rd *bufio.Reader, id SHA1) (*Co | |
return nil, err | ||
} | ||
|
||
commit.CommitMessage = strings.TrimSpace(tag.Message) | ||
commit.CommitMessage = tag.Message | ||
commit.Author = tag.Tagger | ||
commit.Signature = tag.Signature | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we overwriting the commit's data here with incorrect data from the tag? I think this is the root of the problem and I guess if we just remove these three lines, the issue may be fixed. |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,13 @@ func parseTagRef(ref map[string]string) (tag *Tag, err error) { | |
} | ||
} | ||
|
||
tag.Message = strings.TrimSpace(tag.Message) | ||
if tag.Message == "" { | ||
tag.Message = tag.Name | ||
} else if tag.Name != "" { | ||
tag.Message = tag.Name + "\n\n" + tag.Message | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this joining is incorrect, we should not alter the tag message. What was wrong was just the retrieval of the tagged commit message. |
||
|
||
return tag, nil | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,12 @@ tag 1.22.0 | |
tagger Lucas Michot <[email protected]> 1484491741 +0100 | ||
|
||
`), tag: Tag{ | ||
Name: "", | ||
Name: "1.22.0", | ||
ID: SHA1{}, | ||
Object: SHA1{0x3b, 0x11, 0x4a, 0xb8, 0x0, 0xc6, 0x43, 0x2a, 0xd4, 0x23, 0x87, 0xcc, 0xf6, 0xbc, 0x8d, 0x43, 0x88, 0xa2, 0x88, 0x5a}, | ||
Type: "commit", | ||
Tagger: &Signature{Name: "Lucas Michot", Email: "[email protected]", When: time.Unix(1484491741, 0)}, | ||
Message: "", | ||
Message: "1.22.0", | ||
Signature: nil, | ||
}}, | ||
{data: []byte(`object 7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc | ||
|
@@ -39,12 +39,12 @@ test message | |
o | ||
|
||
ono`), tag: Tag{ | ||
Name: "", | ||
Name: "1.22.1", | ||
ID: SHA1{}, | ||
Object: SHA1{0x7c, 0xdf, 0x42, 0xc0, 0xb1, 0xcc, 0x76, 0x3a, 0xb7, 0xe4, 0xc3, 0x3c, 0x47, 0xa2, 0x4e, 0x27, 0xc6, 0x6b, 0xfc, 0xcc}, | ||
Type: "commit", | ||
Tagger: &Signature{Name: "Lucas Michot", Email: "[email protected]", When: time.Unix(1484553735, 0)}, | ||
Message: "test message\no\n\nono", | ||
Message: "1.22.1\n\ntest message\no\n\nono", | ||
Signature: nil, | ||
}}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I think we should not alter the tag message.