diff options
| author | Jeff Carr <[email protected]> | 2025-11-02 21:09:57 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-11-02 21:09:57 -0600 |
| commit | f1dbe15854ba41e5f4706a436a5324b0a4434122 (patch) | |
| tree | ee43fe36e2a1a7e92aa4f8a5787beb2621edb923 /repo.Stats.go | |
| parent | 6475144cd37db9ece2a8df6477df820f642c9907 (diff) | |
work on a stats tag cache file
Diffstat (limited to 'repo.Stats.go')
| -rw-r--r-- | repo.Stats.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/repo.Stats.go b/repo.Stats.go index 03e10d8..d71bf60 100644 --- a/repo.Stats.go +++ b/repo.Stats.go @@ -20,13 +20,15 @@ func initStats() { } } -func (r *Repo) LoadStats() (*Stats, error) { - filename := filepath.Join(r.FullPath, ".git/", "stats.pb") - if fileExists(filename) { - newfilename := filepath.Join(r.FullPath, ".git/origin.pb") - os.Rename(filename, newfilename) +func (r *Repo) LoadStats(remote string) (*Stats, error) { + fullname := filepath.Join(r.FullPath, ".git/", remote+".pb") + if !fileExists(fullname) { + return nil, os.ErrNotExist } - return r.Stats(), nil + stats := NewStats() + stats.Filename = fullname + err := config.ReLoad(stats) + return stats, err } func (r *Repo) Stats() *Stats { @@ -55,7 +57,7 @@ func (r *Repo) Stats() *Stats { return origin } -// todo: move this somewhere +// todo: move this somewhere. where should it go? // fileExists checks if a file exists and is not a directory. func fileExists(filename string) bool { info, err := os.Stat(filename) |
