From 59f10ad0834c78451d002995b43dafbf25c44e4b Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sat, 19 Jan 2019 17:37:42 -0200 Subject: [PATCH] clean: removed deprecated git.short_hash option --- internal/pipe/git/git.go | 12 ++---------- internal/pipe/snapshot/snapshot_test.go | 14 -------------- pkg/config/config.go | 6 ------ www/content/deprecations.md | 2 ++ 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/internal/pipe/git/git.go b/internal/pipe/git/git.go index c48321a5d..95d3696f6 100644 --- a/internal/pipe/git/git.go +++ b/internal/pipe/git/git.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/apex/log" - "github.com/goreleaser/goreleaser/internal/deprecate" "github.com/goreleaser/goreleaser/internal/git" "github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/pkg/context" @@ -24,9 +23,6 @@ func (Pipe) Run(ctx *context.Context) error { if _, err := exec.LookPath("git"); err != nil { return ErrNoGit } - if ctx.Config.Git.ShortHash { - deprecate.Notice("git.short_hash") - } info, err := getInfo(ctx) if err != nil { return err @@ -73,10 +69,6 @@ func getGitInfo(ctx *context.Context) (context.GitInfo, error) { if err != nil { return context.GitInfo{}, errors.Wrap(err, "couldn't get current commit") } - var commit = full - if ctx.Config.Git.ShortHash { - commit = short - } url, err := getURL() if err != nil { return context.GitInfo{}, errors.Wrap(err, "couldn't get remote URL") @@ -84,7 +76,7 @@ func getGitInfo(ctx *context.Context) (context.GitInfo, error) { tag, err := getTag() if err != nil { return context.GitInfo{ - Commit: commit, + Commit: full, FullCommit: full, ShortCommit: short, URL: url, @@ -93,7 +85,7 @@ func getGitInfo(ctx *context.Context) (context.GitInfo, error) { } return context.GitInfo{ CurrentTag: tag, - Commit: commit, + Commit: full, FullCommit: full, ShortCommit: short, URL: url, diff --git a/internal/pipe/snapshot/snapshot_test.go b/internal/pipe/snapshot/snapshot_test.go index b7f994eec..358f19534 100644 --- a/internal/pipe/snapshot/snapshot_test.go +++ b/internal/pipe/snapshot/snapshot_test.go @@ -34,20 +34,6 @@ func TestDefaultSet(t *testing.T) { assert.Equal(t, "snap", ctx.Config.Snapshot.NameTemplate) } -func TestSnapshotNameShortCommitHash(t *testing.T) { - var ctx = context.New(config.Project{ - Snapshot: config.Snapshot{ - NameTemplate: "{{.ShortCommit}}", - }, - }) - ctx.Snapshot = true - ctx.Config.Git.ShortHash = true - ctx.Git.CurrentTag = "v1.2.3" - ctx.Git.ShortCommit = "123" - assert.NoError(t, Pipe{}.Run(ctx)) - assert.Equal(t, ctx.Version, "123") -} - func TestSnapshotInvalidNametemplate(t *testing.T) { var ctx = context.New(config.Project{ Snapshot: config.Snapshot{ diff --git a/pkg/config/config.go b/pkg/config/config.go index 169a606d9..5ab28fbbc 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -273,11 +273,6 @@ type EnvFiles struct { GitHubToken string `yaml:"github_token,omitempty"` } -// Git config -type Git struct { - ShortHash bool `yaml:"short_hash,omitempty"` -} - // Before config type Before struct { Hooks []string `yaml:",omitempty"` @@ -325,7 +320,6 @@ type Project struct { Dist string `yaml:",omitempty"` Sign Sign `yaml:",omitempty"` EnvFiles EnvFiles `yaml:"env_files,omitempty"` - Git Git `yaml:",omitempty"` Before Before `yaml:",omitempty"` // this is a hack ¯\_(ツ)_/¯ diff --git a/www/content/deprecations.md b/www/content/deprecations.md index 9227f788e..18a29b2a1 100644 --- a/www/content/deprecations.md +++ b/www/content/deprecations.md @@ -108,6 +108,8 @@ dockers: ## git.short_hash > since 2018-10-03 +> +> removed 2019-01-19 This property was being used to tell GoReleaser to use short git hashes instead of the full ones. This has been removed in favor of specific