Fix git diff with empty line at the end of the git diff will cause corrupt diff apply message

This commit is contained in:
allegroai 2020-11-11 17:11:28 +02:00
parent 6df0f81ca0
commit 52f30b306a

View File

@ -382,7 +382,8 @@ class VCS(object):
Run command with `input_` as stdin Run command with `input_` as stdin
""" """
input_ = input_.encode("utf-8") input_ = input_.encode("utf-8")
if not input_.endswith(b"\n"): # always add extra empty line
# (there is no downside, and it solves empty lines issue at end of patch cause corrupt message)
input_ += b"\n" input_ += b"\n"
process = self._call_subprocess( process = self._call_subprocess(
subprocess.Popen, subprocess.Popen,