diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-12-15 23:07:17 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-12-15 23:39:42 +0100 |
commit | 697702e72c4b148e987b873e6094da081beeb7cf (patch) | |
tree | 75c7bf4703fbf46844a7e16f2ecca477253dd102 /lib/git | |
parent | b1a2271a03313b561f5b786757feaded3d41b23f (diff) | |
download | gitpython-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')
-rw-r--r-- | lib/git/index.py | 13 | ||||
-rw-r--r-- | lib/git/utils.py | 2 |
2 files changed, 9 insertions, 6 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 diff --git a/lib/git/utils.py b/lib/git/utils.py index b5364c4c..5b061631 100644 --- a/lib/git/utils.py +++ b/lib/git/utils.py @@ -139,7 +139,7 @@ class LockFile(object): raise AssertionError("The lock file at %s could not be read" % lock_file) if pid != os.getpid(): - raise AssertionError("We claim to own the lock at %s, but it was not owned by our process: %i" % (lock_file, os.getpid())) + raise AssertionError("We claim to own the lock at %s, but it was not owned by our process %i, but by %i" % (lock_file, os.getpid(), pid)) return True |