aboutsummaryrefslogtreecommitdiff
path: root/refstore/files/read_list.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-07 18:09:20 +0800
committerGravatar Runxi Yu2026-03-07 18:17:54 +0800
commite667c3c52a535ee67fe895bb0240fbad6e920087 (patch)
tree0815f7cc9b2c4a06d00722bce4c3ac57c515288b /refstore/files/read_list.go
parentreceivepack: Connect protocol with service (diff)
signatureNo signature
refstore/files: Accept timeout instead of reading from config
And split things up again.
Diffstat (limited to 'refstore/files/read_list.go')
-rw-r--r--refstore/files/read_list.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/refstore/files/read_list.go b/refstore/files/read_list.go
index 95d37ccd..358ec007 100644
--- a/refstore/files/read_list.go
+++ b/refstore/files/read_list.go
@@ -2,10 +2,8 @@ package files
import (
"errors"
- "os"
"path"
"slices"
- "strings"
"codeberg.org/lindenii/furgit/ref"
"codeberg.org/lindenii/furgit/refstore"
@@ -76,73 +74,3 @@ func (store *Store) List(pattern string) ([]ref.Ref, error) {
return refs, nil
}
-
-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
-}