From afdc35b3c4038d52405302058e70a78e88f01c89 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 24 May 2006 23:12:28 +0200 Subject: [PATCH] Load config before parsing command line options so they can override --- tig.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tig.c b/tig.c index 49c2492..4c60855 100644 --- a/tig.c +++ b/tig.c @@ -436,6 +436,9 @@ parse_options(int argc, char *argv[]) } + if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8")) + opt_utf8 = FALSE; + return TRUE; } @@ -2472,6 +2475,11 @@ main(int argc, char *argv[]) signal(SIGINT, quit); + /* Load the repo config file first so options can be overwritten from + * the command line. */ + if (load_config() == ERR) + die("Failed to load repo config."); + if (!parse_options(argc, argv)) return 0; @@ -2482,15 +2490,9 @@ main(int argc, char *argv[]) if (refs_size == 0 && opt_request != REQ_VIEW_PAGER) die("Not a git repository"); - if (load_config() == ERR) - die("Failed to load repo config."); - for (i = 0; i < ARRAY_SIZE(views) && (view = &views[i]); i++) view->cmd_env = getenv(view->cmd_env); - if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8")) - opt_utf8 = FALSE; - request = opt_request; init_display(); -- 2.11.0