From 610915dc3a07f06dee7c795dd8eb2325243f1a34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Sun, 21 Dec 2008 11:55:53 +0100 Subject: [PATCH] stg files: Don't write just an empty line MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If we don't produce any output, we shouldn't print a newline. Signed-off-by: Karl Hasselström --- stgit/commands/files.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stgit/commands/files.py b/stgit/commands/files.py index 46d43c1..84925af 100644 --- a/stgit/commands/files.py +++ b/stgit/commands/files.py @@ -59,9 +59,12 @@ def func(parser, options, args): rev2 = git_id(crt_series, '%s' % patch) if options.stat: - out.stdout_raw(gitlib.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n') + output = gitlib.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) elif options.bare: - out.stdout_raw(git.barefiles(rev1, rev2) + '\n') + output = git.barefiles(rev1, rev2) else: - out.stdout_raw(git.files(rev1, rev2, diff_flags = options.diff_flags) - + '\n') + output = git.files(rev1, rev2, diff_flags = options.diff_flags) + if output: + if not output.endswith('\n'): + output += '\n' + out.stdout_raw(output) -- 2.11.0