From 46889d1dce4506813206a8004f6c3e514f22b679 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Jan 2015 12:10:49 +0100 Subject: Auto-update odb caches after fetch or pull. Fixes #34 --- doc/source/changes.rst | 1 + git/remote.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index bd768740..b4535a69 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -6,6 +6,7 @@ Changelog ================ * push/pull/fetch operations will not block anymore * diff() can now properly detect renames, both in patch and raw format. Previously it only worked when create_patch was True. +* repo.odb.update_cache() is now called automatically after fetch and pull operations. In case you did that in your own code, you might want to remove your line to prevent a double-update that causes unnecessary IO. * A list of all fixed issues can be found here: https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.5+-+bugfixes%22+ 0.3.4 - Python 3 Support diff --git a/git/remote.py b/git/remote.py index ce0ed363..1500f3d1 100644 --- a/git/remote.py +++ b/git/remote.py @@ -610,7 +610,9 @@ class Remote(LazyMixin, Iterable): args = [refspec] proc = self.repo.git.fetch(self, *args, with_extended_output=True, as_process=True, v=True, **kwargs) - return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) + res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) + self.repo.odb.update_cache() + return res def pull(self, refspec=None, progress=None, **kwargs): """Pull changes from the given branch, being the same as a fetch followed @@ -622,7 +624,9 @@ class Remote(LazyMixin, Iterable): :return: Please see 'fetch' method """ kwargs = add_progress(kwargs, self.repo.git, progress) proc = self.repo.git.pull(self, refspec, with_extended_output=True, as_process=True, v=True, **kwargs) - return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) + res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) + self.repo.odb.update_cache() + return res def push(self, refspec=None, progress=None, **kwargs): """Push changes from source branch in refspec to target branch in refspec. -- cgit v1.2.3