1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-09 07:14:08 +02:00

clean: removed deprecated git.short_hash option

This commit is contained in:
Carlos Alexandro Becker 2019-01-19 17:37:42 -02:00 committed by Carlos Alexandro Becker
parent ed2ca57bd5
commit 59f10ad083
4 changed files with 4 additions and 30 deletions

View File

@ -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,

View File

@ -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{

View File

@ -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 ¯\_(ツ)_/¯

View File

@ -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