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