diff options
| author | 2026-03-25 14:31:16 +0000 | |
|---|---|---|
| committer | 2026-03-25 14:31:16 +0000 | |
| commit | 48ff647cf4a8bb8f23fcd6b8616f56a8ef72b980 (patch) | |
| tree | ae199c38042adaa544d5f7d31351661d5831381e /refstore/files/read_list_collect.go | |
| parent | *: objectstore -> object/store (diff) | |
*: refstore -> ref/store
Diffstat (limited to 'refstore/files/read_list_collect.go')
| -rw-r--r-- | refstore/files/read_list_collect.go | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/refstore/files/read_list_collect.go b/refstore/files/read_list_collect.go deleted file mode 100644 index f4e2cb69..00000000 --- a/refstore/files/read_list_collect.go +++ /dev/null @@ -1,78 +0,0 @@ -package files - -import ( - "errors" - "os" - "path" - "strings" -) - -func (store *Store) collectLooseRefNames() ([]string, error) { - names := make([]string, 0, 16) - seen := make(map[string]struct{}, 16) - - _, err := store.gitRoot.Stat("HEAD") - if err == nil { - names = append(names, "HEAD") - seen["HEAD"] = struct{}{} - } else if !errors.Is(err, os.ErrNotExist) { - return nil, err - } - - var walk func(*os.Root, string) error - - walk = func(root *os.Root, dir string) error { - file, openErr := root.Open(dir) - if openErr != nil { - if errors.Is(openErr, os.ErrNotExist) { - return nil - } - - return openErr - } - - defer func() { _ = file.Close() }() - - entries, readErr := file.ReadDir(-1) - if readErr != nil { - return readErr - } - - for _, entry := range entries { - name := path.Join(dir, entry.Name()) - if entry.IsDir() { - err := walk(root, name) - if err != nil { - return err - } - - continue - } - - if strings.HasSuffix(name, ".lock") { - continue - } - - if _, ok := seen[name]; ok { - continue - } - - seen[name] = struct{}{} - names = append(names, name) - } - - return nil - } - - err = walk(store.commonRoot, "refs") - if err != nil { - return nil, err - } - - err = walk(store.gitRoot, "refs") - if err != nil { - return nil, err - } - - return names, nil -} |
