From: Karl Hasselström Date: Sun, 21 Dec 2008 10:55:53 +0000 (+0100) Subject: stg files: Don't write just an empty line X-Git-Tag: v0.15-rc1~71 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/610915dc3a07f06dee7c795dd8eb2325243f1a34?ds=sidebyside stg files: Don't write just an empty line If we don't produce any output, we shouldn't print a newline. Signed-off-by: Karl Hasselström --- 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)