From e4c4c06b0457b894ed1f8d6ac11b6e465fd67f09 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Mon, 23 Sep 2024 15:51:53 -0700 Subject: [PATCH] Remove unused RepoModTime function --- gitindex/index.go | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/gitindex/index.go b/gitindex/index.go index ddf73e0d6..b784d1927 100644 --- a/gitindex/index.go +++ b/gitindex/index.go @@ -31,7 +31,6 @@ import ( "sort" "strconv" "strings" - "time" "github.com/sourcegraph/zoekt" "github.com/sourcegraph/zoekt/build" @@ -44,32 +43,6 @@ import ( git "github.com/go-git/go-git/v5" ) -// RepoModTime returns the time of last fetch of a git repository. -func RepoModTime(dir string) (time.Time, error) { - var last time.Time - refDir := filepath.Join(dir, "refs") - if _, err := os.Lstat(refDir); err == nil { - if err := filepath.Walk(refDir, - func(_ string, fi os.FileInfo, _ error) error { - if !fi.IsDir() && last.Before(fi.ModTime()) { - last = fi.ModTime() - } - return nil - }); err != nil { - return last, err - } - } - - // git gc compresses refs into the following file: - for _, fn := range []string{"info/refs", "packed-refs"} { - if fi, err := os.Lstat(filepath.Join(dir, fn)); err == nil && !fi.IsDir() && last.Before(fi.ModTime()) { - last = fi.ModTime() - } - } - - return last, nil -} - // FindGitRepos finds directories holding git repositories below the // given directory. It will find both bare and the ".git" dirs in // non-bare repositories. It returns the full path including the dir