[PATCH v2 0/8] Default pager and editor
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:47:38
Junio C Hamano wrote:
My "how about" patch on DEFAULT_PAGER might be minimally safe with
make DEFAULT_PAGER="/c/my program/less"It isn’t, actually, since in pager.c the pager already gets run through sh if it contains certain shell metacharacters.
but if you are going to do this for real, you would need to use proper quoting in the Makefile (look for _SQ for hints).
Good catch --- thanks.
quoted
This change makes t7005-editor into a mess. Any ideas for fixing this?I think the introduction of DEFAULT_EDITOR makes it unfixable; your DEFAULT_EDITOR may be set to '/usr/bin/vi' not 'vi'. Just detect DEFAULT_EDITOR being not the default 'vi' and abort/skip the entire test, perhaps?
Yep, unfortunately that looks like the best thing to do. I tried to salvage some of the test for distros (like Debian) that might override the default without using an absolute path. Here’s an updated series. It doesn’t provide git var --run yet since the Windows exit status magic means that would require either futzing with the run_pager() implementation or reimplementing cat in var.c. Thoughts? Johannes Sixt (1): Teach git var about GIT_EDITOR Jonathan Nieder (6): launch_editor: Longer error message when TERM=dumb Handle more shell metacharacters in editor name Teach git var about GIT_PAGER add -i, send-email, svn, p4, etc: Use "git var GIT_EDITOR" am -i, git-svn: use $(git var GIT_PAGER) instead of 'less' Provide a build time default-editor setting Junio C Hamano (1): Provide a build time default-pager setting Documentation/config.txt | 4 +--- Documentation/git-commit.txt | 2 +- Documentation/git-send-email.txt | 4 ++-- Documentation/git-var.txt | 14 ++++++++++++++ Makefile | 28 ++++++++++++++++++++++++++++ cache.h | 2 ++ contrib/fast-import/git-p4 | 5 +---- editor.c | 33 ++++++++++++++++++++++++++++----- git-add--interactive.perl | 3 +-- git-am.sh | 5 ++++- git-send-email.perl | 3 ++- git-sh-setup.sh | 19 ++++++------------- git-svn.perl | 11 ++++------- pager.c | 24 ++++++++++++++++++++---- t/t7005-editor.sh | 31 ++++++++++++++++++++++++------- var.c | 20 ++++++++++++++++++++ 16 files changed, 158 insertions(+), 50 deletions(-)