summaryrefslogtreecommitdiff
path: root/lib/git/index.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-12-15 23:07:17 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-12-15 23:39:42 +0100
commit697702e72c4b148e987b873e6094da081beeb7cf (patch)
tree75c7bf4703fbf46844a7e16f2ecca477253dd102 /lib/git/index.py
parentb1a2271a03313b561f5b786757feaded3d41b23f (diff)
downloadgitpython-697702e72c4b148e987b873e6094da081beeb7cf.tar.gz
index: improved the way stdout is handled as the previous handling rarely caused lockups while waiting for stdout
NOTE: This does not have the desired effect, the issue appears to be somewhere within git, possibly, as git simply does not terminate waiting for something, even if stdout is closed.
Diffstat (limited to 'lib/git/index.py')
-rw-r--r--lib/git/index.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/git/index.py b/lib/git/index.py
index 9748df9f..334e84aa 100644
--- a/lib/git/index.py
+++ b/lib/git/index.py
@@ -926,7 +926,7 @@ class IndexFile(LazyMixin, diff.Diffable):
self._write_path_to_stdin(proc, filepath, filepath, make_exc, fprogress, read_from_stdout=False)
added_files.append(filepath)
# END for each filepath
- self._flush_stdin_and_wait(proc) # ignore stdout
+ self._flush_stdin_and_wait(proc, ignore_stdout=True) # ignore stdout
# force rereading our entries once it is all done
del(self.entries)
@@ -978,7 +978,7 @@ class IndexFile(LazyMixin, diff.Diffable):
if not progress_sent:
fprogress(entry.path, True, entry)
# END for each enty
- self._flush_stdin_and_wait(proc)
+ self._flush_stdin_and_wait(proc, ignore_stdout=True)
entries_added.extend(entries)
# END if there are base entries
@@ -1059,10 +1059,13 @@ class IndexFile(LazyMixin, diff.Diffable):
return Commit.create_from_tree(self.repo, tree_sha, message, parent_commits, head)
@classmethod
- def _flush_stdin_and_wait(cls, proc):
+ def _flush_stdin_and_wait(cls, proc, ignore_stdout = False):
proc.stdin.flush()
proc.stdin.close()
- stdout = proc.stdout.read()
+ stdout = ''
+ if not ignore_stdout:
+ stdout = proc.stdout.read()
+ proc.stdout.close()
proc.wait()
return stdout
@@ -1192,7 +1195,7 @@ class IndexFile(LazyMixin, diff.Diffable):
checked_out_files.append(path)
# END path is a file
# END for each path
- self._flush_stdin_and_wait(proc)
+ self._flush_stdin_and_wait(proc, ignore_stdout=True)
handle_stderr(proc, checked_out_files)
return checked_out_files