From 52f30b306a58b606069bc5f56b7a8e14a0b7680e Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 11 Nov 2020 17:11:28 +0200 Subject: [PATCH] Fix git diff with empty line at the end of the git diff will cause corrupt diff apply message --- trains_agent/helper/repo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trains_agent/helper/repo.py b/trains_agent/helper/repo.py index 1af581c..132733e 100644 --- a/trains_agent/helper/repo.py +++ b/trains_agent/helper/repo.py @@ -382,8 +382,9 @@ class VCS(object): Run command with `input_` as stdin """ input_ = input_.encode("utf-8") - if not input_.endswith(b"\n"): - input_ += 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" process = self._call_subprocess( subprocess.Popen, argv,