Skip to content

Commit

Permalink
Remove unused RepoModTime function
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Sep 23, 2024
1 parent 5379bc9 commit e4c4c06
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions gitindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"sort"
"strconv"
"strings"
"time"

"github.com/sourcegraph/zoekt"
"github.com/sourcegraph/zoekt/build"
Expand All @@ -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
Expand Down

0 comments on commit e4c4c06

Please sign in to comment.