Skip to content

Commit

Permalink
fix: avoid deadlock when accessing git object for large file
Browse files Browse the repository at this point in the history
Thanks to @scamille for this fix!
  • Loading branch information
hallettj committed Feb 25, 2024
1 parent d183425 commit 0d7d162
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions git-format-staged
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,9 @@ def format_object(formatter, object_hash, file_path, verbose=False):
stdout=subprocess.PIPE
)

get_content.stdout.close()
format_content.stdout.close()

if get_content.wait() != 0:
raise ValueError('unable to read file content from object database: ' + object_hash)

if format_content.wait() != 0:
raise Exception('formatter exited with non-zero status') # TODO: capture stderr from format command

get_content.communicate()
format_content.communicate()

new_hash, err = write_object.communicate()

if write_object.returncode != 0:
Expand Down

0 comments on commit 0d7d162

Please sign in to comment.