Skip to content

Commit 46889d1

Browse files
committed
Auto-update odb caches after fetch or pull.
Fixes #34
1 parent de4cfcc commit 46889d1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog
66
================
77
* push/pull/fetch operations will not block anymore
88
* diff() can now properly detect renames, both in patch and raw format. Previously it only worked when create_patch was True.
9+
* 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.
910
* 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+
1011

1112
0.3.4 - Python 3 Support

git/remote.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ def fetch(self, refspec=None, progress=None, **kwargs):
610610
args = [refspec]
611611

612612
proc = self.repo.git.fetch(self, *args, with_extended_output=True, as_process=True, v=True, **kwargs)
613-
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
613+
res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
614+
self.repo.odb.update_cache()
615+
return res
614616

615617
def pull(self, refspec=None, progress=None, **kwargs):
616618
"""Pull changes from the given branch, being the same as a fetch followed
@@ -622,7 +624,9 @@ def pull(self, refspec=None, progress=None, **kwargs):
622624
:return: Please see 'fetch' method """
623625
kwargs = add_progress(kwargs, self.repo.git, progress)
624626
proc = self.repo.git.pull(self, refspec, with_extended_output=True, as_process=True, v=True, **kwargs)
625-
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
627+
res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
628+
self.repo.odb.update_cache()
629+
return res
626630

627631
def push(self, refspec=None, progress=None, **kwargs):
628632
"""Push changes from source branch in refspec to target branch in refspec.

0 commit comments

Comments
 (0)