2017-07-18 05:21:12 +02:00
package git
2018-08-21 04:18:43 +02:00
import (
"errors"
"fmt"
)
2017-07-18 05:21:12 +02:00
2020-05-26 05:48:10 +02:00
// ErrDirty happens when the repo has uncommitted/unstashed changes.
2017-07-18 05:21:12 +02:00
type ErrDirty struct {
status string
}
func ( e ErrDirty ) Error ( ) string {
2021-11-21 17:47:25 +02:00
return fmt . Sprintf ( "git is currently in a dirty state\nPlease check in your pipeline what can be changing the following files:\n%v\nLearn more at https://goreleaser.com/errors/dirty\n" , e . status )
2017-07-18 05:21:12 +02:00
}
2020-05-26 05:48:10 +02:00
// ErrWrongRef happens when the HEAD reference is different from the tag being built.
2017-07-18 05:21:12 +02:00
type ErrWrongRef struct {
commit , tag string
}
func ( e ErrWrongRef ) Error ( ) string {
return fmt . Sprintf ( "git tag %v was not made against commit %v" , e . tag , e . commit )
}
// ErrNoTag happens if the underlying git repository doesn't contain any tags
// but no snapshot-release was requested.
2020-12-22 16:04:51 +02:00
var ErrNoTag = errors . New ( "git doesn't contain any tags. Either add a tag or use --snapshot" )
2018-02-26 01:17:45 +02:00
// ErrNotRepository happens if you try to run goreleaser against a folder
// which is not a git repository.
2018-08-21 04:18:43 +02:00
var ErrNotRepository = errors . New ( "current folder is not a git repository" )
// ErrNoGit happens when git is not present in PATH.
var ErrNoGit = errors . New ( "git not present in PATH" )