summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-11-17 11:39:05 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-11-17 11:39:05 +0100
commit93ae6ecfffda7923b9f7f82d122d39c362be9c44 (patch)
tree07fe72c616fea0c36a968f523e9ad75dbe6c19e6
parentca4c1b87b3fdedd98a0b9e7a8cf02033b5aaa1c8 (diff)
downloadgitpython-93ae6ecfffda7923b9f7f82d122d39c362be9c44.tar.gz
Fixed regression that would possibly have caused an abundance of chdir calls.
-rw-r--r--git/index/base.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 1dada729..43f0be84 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -559,9 +559,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# END for each item
return (paths, entries)
- @git_working_dir
def _store_path(self, filepath, fprogress):
- """Store file at filepath in the database and return the base index entry"""
+ """Store file at filepath in the database and return the base index entry
+ Needs the git_working_dir decorator active ! This must be assured in the calling code"""
st = os.lstat(filepath) # handles non-symlinks as well
stream = None
if S_ISLNK(st.st_mode):
@@ -707,13 +707,17 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# create objects if required, otherwise go with the existing shas
null_entries_indices = [ i for i,e in enumerate(entries) if e.binsha == Object.NULL_BIN_SHA ]
if null_entries_indices:
- for ei in null_entries_indices:
- null_entry = entries[ei]
- new_entry = self._store_path(null_entry.path, fprogress)
-
- # update null entry
- entries[ei] = BaseIndexEntry((null_entry.mode, new_entry.binsha, null_entry.stage, null_entry.path))
- # END for each entry index
+ @git_working_dir
+ def handle_null_entries(self):
+ for ei in null_entries_indices:
+ null_entry = entries[ei]
+ new_entry = self._store_path(null_entry.path, fprogress)
+
+ # update null entry
+ entries[ei] = BaseIndexEntry((null_entry.mode, new_entry.binsha, null_entry.stage, null_entry.path))
+ # END for each entry index
+ # end closure
+ handle_null_entries(self)
# END null_entry handling
# REWRITE PATHS