summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-08 12:10:49 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-08 12:10:49 +0100
commit46889d1dce4506813206a8004f6c3e514f22b679 (patch)
treea3479e8d00f8b4586f85f400855df9d96520ce38
parentde4cfcc4a1fcb24b72a31c5feff8c67d2ff930fc (diff)
downloadgitpython-46889d1dce4506813206a8004f6c3e514f22b679.tar.gz
Auto-update odb caches after fetch or pull.
Fixes #34
-rw-r--r--doc/source/changes.rst1
-rw-r--r--git/remote.py8
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.