From fdf4cb43a1c8133e013fd8ca2d1a5753ea048c90 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Wed, 5 Jul 2006 19:27:02 +0100 Subject: [PATCH] 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 --- stgit/commands/diff.py | 4 +++- stgit/commands/show.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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) -- 2.11.0