Evaluate symlinks when running FetchAll.
For SlothFS, git repositories are cold and bulky data, so they are
good candidate to put onto a spinning disk via symlinks. To ensure
that we still run FetchAll over these, deref the gitCache directory
before the directory walk.
Tested:
Manually verified that git fetches are being executed again.
Change-Id: I6965e6a525485cec10678be46f640fafaf57236d
diff --git a/cache/gitcache.go b/cache/gitcache.go
index fa8c827..8625e4f 100644
--- a/cache/gitcache.go
+++ b/cache/gitcache.go
@@ -88,8 +88,13 @@
// FetchAll finds all known repos and runs git-fetch on them.
func (c *gitCache) FetchAll() error {
+ dir, err := filepath.EvalSymlinks(c.dir)
+ if err != nil {
+ return err
+ }
+
var dirs []string
- if err := filepath.Walk(c.dir, func(n string, fi os.FileInfo, err error) error {
+ if err := filepath.Walk(dir, func(n string, fi os.FileInfo, err error) error {
if fi.IsDir() && strings.HasSuffix(n, ".git") {
dirs = append(dirs, n)
return filepath.SkipDir