1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fixed tag and shit

This commit is contained in:
Carlos Alexandro Becker 2016-12-29 09:00:03 -02:00
parent b99db9dd97
commit 6880f3b86b
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 11 additions and 2 deletions

View File

@ -21,8 +21,10 @@ func getTag(ref string) (tag string, err error) {
"--tags",
"--abbrev=0",
"--always",
ref,
)
if ref != "" {
cmd.Args = append(cmd.Args, ref)
}
bts, err := cmd.CombinedOutput()
if err != nil {
return tag, errors.New(err.Error() + ": " + string(bts))

View File

@ -17,4 +17,11 @@ func TestPreviousTag(t *testing.T) {
tag, err := PreviousTag("v0.0.1")
assert.NoError(err)
assert.NotEmpty(tag)
}
}
func TestInvalidRef(t *testing.T) {
assert := assert.New(t)
tag, err := PreviousTag("this-should-not-exist")
assert.Error(err)
assert.Empty(tag)
}