Thread (30 messages) flat view 30 messages, 5 authors, 2016-06-15

Re: [PATCH 0/4] git --paginate: do not commit pager choice too early

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:08
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano wrote:
... and for commands that do not use RUN_SETUP, what happens?
run_builtin() still commits pager choice.  The bug is neither
fixed nor made worse for them.
Missing from the above enumeration are are external commands.  They depend
on commit_pager_choice() to be called before execv_dashed_external() gets
called.  For example, "git -p request-pull $args" no longer works with
this patch.
Something like the following may help.

This does not protect against calling setup_pager() more than
once.  Once the first pager has been set up, isatty(1) is false,
preventing additional pagers from being spawned and competing with it.

As futureproofing against --paginate=always, setup_pager() should
probably be taught to check pager_in_use(), but that should
probably wait for a separate patch.
diff --git a/git.c b/git.c
index 25e7693..2dcd952 100644
--- a/git.c
+++ b/git.c
@@ -162,6 +162,7 @@ static int handle_alias(int *argcp, const char ***argv)
 	int unused_nongit;
 
 	subdir = setup_git_directory_gently(&unused_nongit);
+	commit_pager_choice();
 
 	alias_command = (*argv)[0];
 	alias_string = alias_lookup(alias_command);
@@ -433,6 +434,7 @@ static void execv_dashed_external(const char **argv)
 	int status;
 
 	strbuf_addf(&cmd, "git-%s", argv[0]);
+	commit_pager_choice();
 
 	/*
 	 * argv[0] must be the git command, but the argv array
-- 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help