Skip to content

Commit

Permalink
git: do not show warnings if project does not use git
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
  • Loading branch information
tonistiigi committed Dec 16, 2022
1 parent 0d1fea8 commit 0594f8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st
gitc, err := gitutil.New(gitutil.WithContext(ctx), gitutil.WithWorkingDir(wd))
if err != nil {
if st, err := os.Stat(path.Join(wd, ".git")); err == nil && st.IsDir() {
return res, errors.New("No git was found in the system. Current commit information was not captured by the build.")
return res, errors.New("git was not found in the system. Current commit information was not captured by the build")
}
return
}

if !gitc.IsInsideWorkTree() {
return res, errors.New("Not inside a git repository")
return res, nil
}

if sha, err := gitc.FullCommit(); err != nil {
Expand Down

0 comments on commit 0594f8a

Please sign in to comment.