@@ -51,21 +51,21 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st
5151
5252 gitc , err := gitutil .New (gitutil .WithContext (ctx ), gitutil .WithWorkingDir (wd ))
5353 if err != nil {
54- if st , err := os .Stat (path .Join (wd , ".git" )); err == nil && st .IsDir () {
55- return res , errors .New ( "buildx: git was not found in the system. Current commit information was not captured by the build " )
54+ if st , err1 := os .Stat (path .Join (wd , ".git" )); err1 == nil && st .IsDir () {
55+ return res , errors .Wrap ( err , " git was not found in the system" )
5656 }
5757 return
5858 }
5959
6060 if ! gitc .IsInsideWorkTree () {
6161 if st , err := os .Stat (path .Join (wd , ".git" )); err == nil && st .IsDir () {
62- return res , errors .New ("buildx: failed to read current commit information with git rev-parse --is-inside-work-tree" )
62+ return res , errors .New ("failed to read current commit information with git rev-parse --is-inside-work-tree" )
6363 }
6464 return res , nil
6565 }
6666
6767 if sha , err := gitc .FullCommit (); err != nil && ! gitutil .IsUnknownRevision (err ) {
68- return res , errors .Wrapf (err , "buildx: failed to get git commit" )
68+ return res , errors .Wrap (err , "failed to get git commit" )
6969 } else if sha != "" {
7070 checkDirty := false
7171 if v , ok := os .LookupEnv ("BUILDX_GIT_CHECK_DIRTY" ); ok {
@@ -95,7 +95,7 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st
9595
9696 if setGitLabels {
9797 if root , err := gitc .RootDir (); err != nil {
98- return res , errors .Wrapf (err , "buildx: failed to get git root dir" )
98+ return res , errors .Wrap (err , "failed to get git root dir" )
9999 } else if root != "" {
100100 if dockerfilePath == "" {
101101 dockerfilePath = filepath .Join (wd , "Dockerfile" )
0 commit comments