+3
-2
knotserver/git/git.go
+3
-2
knotserver/git/git.go
···
300
}
301
302
func (g *GitRepo) LastCommitForPath(path string) (*object.Commit, error) {
303
cacheMu.RLock()
304
-
if commit, found := commitCache.Get(path); found {
305
cacheMu.RUnlock()
306
return commit.(*object.Commit), nil
307
}
···
330
}
331
332
cacheMu.Lock()
333
-
commitCache.Set(path, commit, 1)
334
cacheMu.Unlock()
335
336
return commit, nil
···
300
}
301
302
func (g *GitRepo) LastCommitForPath(path string) (*object.Commit, error) {
303
+
cacheKey := fmt.Sprintf("%s:%s", g.h.String(), path)
304
cacheMu.RLock()
305
+
if commit, found := commitCache.Get(cacheKey); found {
306
cacheMu.RUnlock()
307
return commit.(*object.Commit), nil
308
}
···
331
}
332
333
cacheMu.Lock()
334
+
commitCache.Set(cacheKey, commit, 1)
335
cacheMu.Unlock()
336
337
return commit, nil