324
324
diff_format_registry.register_lazy('git', 'bzrlib.plugins.git.send',
325
325
'GitDiffTree', 'Git am-style diff format')
328
def update_git_cache(repository, revid):
329
"""Update the git cache after a local commit."""
330
if getattr(repository, "_git", None) is not None:
331
return # No need to update cache for git repositories
333
from bzrlib.plugins.git.object_store import BazaarObjectStore
334
if not repository.control_transport.has("git"):
335
return # No existing cache, don't bother updating
336
store = BazaarObjectStore(repository)
339
store._update_sha_map_revision(revid)
344
def post_commit_update_cache(local_branch, master_branch, old_revno, old_revid,
345
new_revno, new_revid):
346
if local_branch is not None:
347
update_git_cache(local_branch.repository, new_revid)
348
update_git_cache(master_branch.repository, new_revid)
352
from bzrlib.hooks import install_lazy_named_hook
353
except ImportError: # Compatibility with bzr < 2.4
356
install_lazy_named_hook("bzrlib.branch",
357
"Branch.hooks", "post_commit", post_commit_update_cache,
327
361
def test_suite():
328
362
from bzrlib.plugins.git import tests
329
363
return tests.test_suite()