From: Catalin Marinas Date: Wed, 5 Jul 2006 18:27:02 +0000 (+0100) Subject: Do not use the pager when the output is empty X-Git-Tag: v0.14.3~476 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/fdf4cb43a1c8133e013fd8ca2d1a5753ea048c90 Do not use the pager when the output is empty This is for the diff and show commands to not run the output through the pager if there is nothing to display. Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/diff.py b/stgit/commands/diff.py index caa3c5b..9abd438 100644 --- a/stgit/commands/diff.py +++ b/stgit/commands/diff.py @@ -78,4 +78,6 @@ def func(parser, options, args): if options.stat: print git.diffstat(args, git_id(rev1), git_id(rev2)) else: - pager(git.diff(args, git_id(rev1), git_id(rev2))) + diff_str = git.diff(args, git_id(rev1), git_id(rev2)) + if diff_str: + pager(diff_str) diff --git a/stgit/commands/show.py b/stgit/commands/show.py index 9537192..a3169b9 100644 --- a/stgit/commands/show.py +++ b/stgit/commands/show.py @@ -43,4 +43,6 @@ def func(parser, options, args): parser.error('incorrect number of arguments') commit_id = git_id(patch) - pager(git.pretty_commit(commit_id)) + commit_str = git.pretty_commit(commit_id) + if commit_str: + pager(commit_str)