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:
parent
ed2ca57bd5
commit
59f10ad083
@ -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,
|
||||
|
@ -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{
|
||||
|
@ -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 ¯\_(ツ)_/¯
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user