fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Remove unused RepoModTime function (#834)

-27
-27
gitindex/index.go
··· 31 31 "sort" 32 32 "strconv" 33 33 "strings" 34 - "time" 35 34 36 35 "github.com/sourcegraph/zoekt" 37 36 "github.com/sourcegraph/zoekt/build" ··· 43 42 44 43 git "github.com/go-git/go-git/v5" 45 44 ) 46 - 47 - // RepoModTime returns the time of last fetch of a git repository. 48 - func RepoModTime(dir string) (time.Time, error) { 49 - var last time.Time 50 - refDir := filepath.Join(dir, "refs") 51 - if _, err := os.Lstat(refDir); err == nil { 52 - if err := filepath.Walk(refDir, 53 - func(_ string, fi os.FileInfo, _ error) error { 54 - if !fi.IsDir() && last.Before(fi.ModTime()) { 55 - last = fi.ModTime() 56 - } 57 - return nil 58 - }); err != nil { 59 - return last, err 60 - } 61 - } 62 - 63 - // git gc compresses refs into the following file: 64 - for _, fn := range []string{"info/refs", "packed-refs"} { 65 - if fi, err := os.Lstat(filepath.Join(dir, fn)); err == nil && !fi.IsDir() && last.Before(fi.ModTime()) { 66 - last = fi.ModTime() 67 - } 68 - } 69 - 70 - return last, nil 71 - } 72 45 73 46 // FindGitRepos finds directories holding git repositories below the 74 47 // given directory. It will find both bare and the ".git" dirs in