Skip to content

Commit

Permalink
feat: show git status (siderolabs#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrynhard authored Nov 21, 2018
1 parent 76217df commit 0fdd552
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ var buildCmd = &cobra.Command{
}
}
}
if !e.Metadata.Git.IsClean {
fmt.Printf("Git status:\n%s\n", e.Metadata.Git.Status)
}
if err := e.Pipeline.Build(e.Metadata, e.Stages, e.Tasks); err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down
4 changes: 3 additions & 1 deletion pkg/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Git struct {
Message string
SHA string
Tag string
Status string
IsBranch bool
IsClean bool
IsTag bool
Expand Down Expand Up @@ -196,10 +197,11 @@ func addSHAMetadataForGit(g *git.Git, m *Metadata) error {
}

func addStatusMetadataForGit(g *git.Git, m *Metadata) error {
_, isClean, err := g.Status()
status, isClean, err := g.Status()
if err != nil {
return err
}
m.Git.Status = status
m.Git.IsClean = isClean

return nil
Expand Down

0 comments on commit 0fdd552

Please sign in to comment.