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 --- git/remote.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'git') 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