This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git


The following commit(s) were added to refs/heads/main by this push:
     new 7a3b6cc  fix: add helpful error message for git repository issues 
(#260)
7a3b6cc is described below

commit 7a3b6cc34c5980cede4407ffa06fe553a999245d
Author: Jonathan Hult <[email protected]>
AuthorDate: Wed Feb 11 09:08:15 2026 -0600

    fix: add helpful error message for git repository issues (#260)
---
 pkg/header/check.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkg/header/check.go b/pkg/header/check.go
index 9a02953..4981dda 100644
--- a/pkg/header/check.go
+++ b/pkg/header/check.go
@@ -34,6 +34,7 @@ import (
        "github.com/bmatcuk/doublestar/v2"
        "github.com/go-git/go-billy/v5/osfs"
        "github.com/go-git/go-git/v5"
+       "github.com/go-git/go-git/v5/plumbing"
        "github.com/go-git/go-git/v5/plumbing/format/gitignore"
        "github.com/go-git/go-git/v5/plumbing/object"
        "golang.org/x/sync/errgroup"
@@ -122,6 +123,11 @@ func listFiles(config *ConfigHeader) ([]string, error) {
                                        candidates = append(candidates, 
file.Name)
                                        return nil
                                }); err != nil {
+                                       if errors.Is(err, 
plumbing.ErrObjectNotFound) {
+                                               return nil, errors.New(
+                                                       "failed to read git 
repository. Run 'git fsck' to diagnose. If dangling objects are found, run: git 
prune && git gc --prune=now --aggressive",
+                                               )
+                                       }
                                        return nil, err
                                }
                        }

Reply via email to