Skip to content

Commit 6b28ddf

Browse files
committed
print status when git is in a dirt state - fixes #10
1 parent f66613e commit 6b28ddf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/utils/git.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package utils
33
import "strings"
44

55
// IsDirty checks whether a repository is in a dirty state (has uncommitted changes).
6-
func IsDirty() bool {
6+
func IsDirty() (bool, string) {
77
out, err := RunCommand("git", "status", "--porcelain")
88
if strings.TrimSpace(out) != "" || err != nil {
9-
return true
9+
return true, out
1010
}
11-
return false
11+
return false, ""
1212
}
1313

1414
// GetTag gets the latest git tag for a repository.

pkg/v1/stages/setup/setup.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ func (Stage) Run(ctx *ctx.Context) error {
4343
}
4444

4545
log.Debug("checking if git is in a clean state")
46-
if utils.IsDirty() {
46+
if isDirty, out := utils.IsDirty(); isDirty {
4747
if ctx.AllowDirty {
4848
log.Info("allowing git to be in a dirty state")
4949
} else {
5050
if err := ctx.CheckDryRun(ErrDirtyGit); err != nil {
51+
log.Errorf("dirty git state detected\n" + out)
5152
return err
5253
}
5354
}

0 commit comments

Comments
 (0)