Skip to content

Commit 697702e

Browse files
committed
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.
1 parent b1a2271 commit 697702e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/git/index.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def add(self, items, force=True, fprogress=lambda *args: None):
926926
self._write_path_to_stdin(proc, filepath, filepath, make_exc, fprogress, read_from_stdout=False)
927927
added_files.append(filepath)
928928
# END for each filepath
929-
self._flush_stdin_and_wait(proc) # ignore stdout
929+
self._flush_stdin_and_wait(proc, ignore_stdout=True) # ignore stdout
930930

931931
# force rereading our entries once it is all done
932932
del(self.entries)
@@ -978,7 +978,7 @@ def add(self, items, force=True, fprogress=lambda *args: None):
978978
if not progress_sent:
979979
fprogress(entry.path, True, entry)
980980
# END for each enty
981-
self._flush_stdin_and_wait(proc)
981+
self._flush_stdin_and_wait(proc, ignore_stdout=True)
982982
entries_added.extend(entries)
983983
# END if there are base entries
984984

@@ -1059,10 +1059,13 @@ def commit(self, message, parent_commits=None, head=True):
10591059
return Commit.create_from_tree(self.repo, tree_sha, message, parent_commits, head)
10601060

10611061
@classmethod
1062-
def _flush_stdin_and_wait(cls, proc):
1062+
def _flush_stdin_and_wait(cls, proc, ignore_stdout = False):
10631063
proc.stdin.flush()
10641064
proc.stdin.close()
1065-
stdout = proc.stdout.read()
1065+
stdout = ''
1066+
if not ignore_stdout:
1067+
stdout = proc.stdout.read()
1068+
proc.stdout.close()
10661069
proc.wait()
10671070
return stdout
10681071

@@ -1192,7 +1195,7 @@ def handle_stderr(proc, iter_checked_out_files):
11921195
checked_out_files.append(path)
11931196
# END path is a file
11941197
# END for each path
1195-
self._flush_stdin_and_wait(proc)
1198+
self._flush_stdin_and_wait(proc, ignore_stdout=True)
11961199

11971200
handle_stderr(proc, checked_out_files)
11981201
return checked_out_files

lib/git/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _has_lock(self):
139139
raise AssertionError("The lock file at %s could not be read" % lock_file)
140140

141141
if pid != os.getpid():
142-
raise AssertionError("We claim to own the lock at %s, but it was not owned by our process: %i" % (lock_file, os.getpid()))
142+
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))
143143

144144
return True
145145

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy