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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-- 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]