From bfb656fdb66ed2525970518507e758c6413eb5b9 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 28 May 2021 12:36:20 +0300 Subject: [PATCH] Feat(submodules/diff-name-only): Use pager Pipe to pager if stdout is a terminal or to `cat -` to allow redirection. --- submodules/diff-name-only | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/diff-name-only b/submodules/diff-name-only index 2209563..3736e8e 100755 --- a/submodules/diff-name-only +++ b/submodules/diff-name-only @@ -11,11 +11,11 @@ to_commit="${2:-HEAD}" export from_commit to_commit # In the superproject -git --no-pager diff --name-only "$from_commit" "$to_commit" +{ git --no-pager diff --name-only "$from_commit" "$to_commit" git submodule foreach ' # In submodule "$name" prev_commit=`(git -C "$toplevel" ls-tree "$from_commit" "$sm_path" | awk "{print \\$3}")` curr_commit=`(git -C "$toplevel" ls-tree "$to_commit" "$sm_path" | awk "{print \\$3}")` git --no-pager diff --name-only $prev_commit $curr_commit -' +'; } | { test -t 1 && ${PAGER:-less} || cat -; } -- 2.39.2