Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hopefully fix GitPlugin's broken caching behavior.

This hopefully fixes all the "no such changeset" errors in Trac.  Basically
trac-admin's changeset added event updates trac-admin's GitPlugin's cache
(and Trac's persistent cache), but Trac that's running under Apache is a
separate process and thus GitPlugin's non-peristent cache goes stale without
GitPlugin knowing it.  Trac's persistent cache contains a new changeset, Trac
attempts to construct a CachedChangeset, which calls normalize_rev, which in
turn calls verifyrev.  This fix causes verifyrev to rebuild GitPlugin's cache
if git rev-parse returns a valid SHA that isn't in the current cache.
  • Loading branch information...
commit f65bc126fd9d2926a81f0d0ae5009edc986c8cf3 1 parent 4d8d447
scbash scbash authored committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 tracext/git/PyGIT.py
6 tracext/git/PyGIT.py
View
@@ -503,6 +503,11 @@ def verifyrev(self, rev):
if rc in _rev_cache.rev_dict:
return rc
+ elif GitCore.is_sha(rc):
+ # rev-parse returned a sha, it's possible the db is just out of date
+ # Flag the db for rebuilding, and try again
+ self.__rev_cache = None
+ return self.verifyrev(rev)
if rc in _rev_cache.tag_set:
sha = self.repo.cat_file("tag", rc).split(None, 2)[:2]
@@ -510,6 +515,7 @@ def verifyrev(self, rev):
self.logger.debug("unexpected result from 'git-cat-file tag %s'" % rc)
return None
return sha[1]
+ # XXX might need a "db is out of date" branch here as well
return None
Please sign in to comment.
Something went wrong with that request. Please try again.