1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-17 01:42:37 +02:00

fixed first release log

This commit is contained in:
Carlos Alexandro Becker
2017-04-23 16:33:44 -03:00
parent 3c9a8abb6e
commit 0382ef24f3
2 changed files with 55 additions and 5 deletions

View File

@ -93,11 +93,20 @@ func getChangelog(tag string) (string, error) {
if err != nil {
return "", err
}
return git("log", "--pretty=oneline", "--abbrev-commit", prev+".."+tag)
if !prev.Tag {
return gitLog(prev.SHA, tag)
}
return gitLog(fmt.Sprintf("%v..%v", prev.SHA, tag))
}
func gitLog(refs ...string) (string, error) {
var args = []string{"log", "--pretty=oneline", "--abbrev-commit"}
args = append(args, refs...)
return git(args...)
}
func getInfo() (tag, commit string, err error) {
tag, err = cleanGit("describe", "--tags", "--abbrev=0", "--always")
tag, err = cleanGit("describe", "--tags", "--abbrev=0")
if err != nil {
return
}
@ -105,10 +114,21 @@ func getInfo() (tag, commit string, err error) {
return
}
func previous(tag string) (previous string, err error) {
previous, err = cleanGit("describe", "--tags", "--abbrev=0", "--always", tag+"^")
func previous(tag string) (r ref, err error) {
var previous string
var istag = true
previous, err = cleanGit("describe", "--tags", "--abbrev=0", tag+"^")
if err != nil {
istag = false
previous, err = cleanGit("rev-list", "--max-parents=0", "HEAD")
}
return
return ref{
Tag: istag,
SHA: previous,
}, err
}
type ref struct {
Tag bool
SHA string
}