mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-18 03:56:52 +02:00
fix: getting previous tag
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
27cbbd8e66
commit
f90df0f5ec
@ -205,11 +205,11 @@ func getCommitDate(ctx *context.Context) (time.Time, error) {
|
||||
}
|
||||
|
||||
func getShortCommit(ctx *context.Context) (string, error) {
|
||||
return git.Clean(git.Run(ctx, "show", "--format='%h'", "HEAD", "--quiet"))
|
||||
return git.Clean(git.Run(ctx, "show", "--format=%h", "HEAD", "--quiet"))
|
||||
}
|
||||
|
||||
func getFullCommit(ctx *context.Context) (string, error) {
|
||||
return git.Clean(git.Run(ctx, "show", "--format='%H'", "HEAD", "--quiet"))
|
||||
return git.Clean(git.Run(ctx, "show", "--format=%H", "HEAD", "--quiet"))
|
||||
}
|
||||
|
||||
func getSummary(ctx *context.Context) (string, error) {
|
||||
@ -294,7 +294,7 @@ func previousTagSha(ctx *context.Context, current string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return git.Clean(git.Run(ctx, "show", "--format='%h'", tag, "--quiet"))
|
||||
return git.Clean(git.Run(ctx, "rev-list", "-n1", tag))
|
||||
}
|
||||
|
||||
func getURL(ctx *context.Context) (string, error) {
|
||||
|
@ -192,11 +192,13 @@ func TestValidState(t *testing.T) {
|
||||
testlib.GitRemoteAdd(t, "git@github.com:foo/bar.git")
|
||||
testlib.GitCommit(t, "commit3")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "commit4")
|
||||
testlib.GitTag(t, "v0.0.2")
|
||||
testlib.GitCommit(t, "commit4")
|
||||
testlib.GitTag(t, "v0.0.3")
|
||||
ctx := context.New(config.Project{})
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
require.Equal(t, "v0.0.2", ctx.Git.CurrentTag)
|
||||
require.Equal(t, "v0.0.2", ctx.Git.PreviousTag)
|
||||
require.Equal(t, "v0.0.3", ctx.Git.CurrentTag)
|
||||
require.Equal(t, "git@github.com:foo/bar.git", ctx.Git.URL)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user