Re: [PATCH 8/9] builtin: check pager.<cmd> configuration if RUN_SETUP_GENTLY is used

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

 



2010/4/13 Jonathan Nieder <jrnieder@xxxxxxxxx>:
> Eventually, all git commands should check their configuration at
> start-up.  For now, reading configuration before repository discovery
> is dangerous because it could cause a pager.<cmd> setting from the
> current repository to be neglected.
>
> But for commands with RUN_SETUP or RUN_SETUP_GENTLY set, it is safe.
>
> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
> ---
>  git.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/git.c b/git.c
> index 20e9bfc..56e93cf 100644
> --- a/git.c
> +++ b/git.c
> @@ -251,7 +251,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>                        prefix = setup_git_directory_gently(&nongit_ok);
>                }
>
> -               if (use_pager == -1 && p->option & RUN_SETUP)
> +               if (use_pager == -1 && p->option & (RUN_SETUP | RUN_SETUP_GENTLY))
>                        use_pager = check_pager_config(p->cmd);
>                if (use_pager == -1 && p->option & USE_PAGER)
>                        use_pager = 1;

This still leaves a chance of going wrong: when user explicitly gives
"--paginate", use_pager will be 1, but commands like "git init" does
not have RUN_SETUP*. So when setup_pager is called later on, it will
mess things up. This could be solved completely (indeed I have a patch
under testing), but it would require unset_git_directory(), making
this series a bit longer :(


-- 
Duy
--
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]