[PATCH 43/43] builtins: do not commit pager choice early
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Apr 5, 2010, 18:41 UTC
- Message-ID
- <1270492888-26589-44-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <1270492888-26589-1-git-send-email-pclouds@gmail.com>
Committing pager choice may require setting up the pager, which will need access to repository.
At the time after handle_options() is called, the repository has not been found yet. As a result, unallowed access to repository may happen.
There are several possible code path after handle_options()/commit_pager_choice() is called:
1. list_common_cmds_help() 2. run_argv() 3. help_unknown_cmd()
Case 2. will have commit_pager_choice() called inside run_builtin() if a command is found. Case 1. and 3. won't need a pager, it's short printout and should be fitted within a screen. So, removing commit_pager_choice() call after handle_options() is safe.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- git.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/git.c b/git.c index 1fb478f..060cfe8 100644 --- a/git.c +++ b/git.c @@ -521,7 +521,6 @@ int main(int argc, const char **argv) argv++; argc--; handle_options(&argv, &argc, NULL); - commit_pager_choice(); if (argc > 0) { if (!prefixcmp(argv[0], "--")) argv[0] += 2;
-- 1.7.0.rc1.541.g2da82.dirty