X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git.c;h=68334f6a3134bb76a8ffc59e4da773400c59a388;hb=ad5aeeded3295589b2573b143f754762a56f8f82;hp=50a14013c5a87fed200df0a5a4ec6db0f1e2c223;hpb=ae893e097ecbcbd8c6bea50017eb8cedddc5eaba;p=git.git diff --git a/git.c b/git.c index 50a14013c..68334f6a3 100644 --- a/git.c +++ b/git.c @@ -6,27 +6,35 @@ #include "run-command.h" const char git_usage_string[] = - "git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n" + "git [--version] [--exec-path[=]] [--html-path]\n" " [-p|--paginate|--no-pager] [--no-replace-objects]\n" - " [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n" + " [--bare] [--git-dir=] [--work-tree=]\n" " [-c name=value] [--help]\n" - " COMMAND [ARGS]"; + " []"; const char git_more_info_string[] = - "See 'git help COMMAND' for more information on a specific command."; + "See 'git help ' for more information on a specific command."; static struct startup_info git_startup_info; static int use_pager = -1; struct pager_config { const char *cmd; - int val; + int want; + char *value; }; static int pager_command_config(const char *var, const char *value, void *data) { struct pager_config *c = data; - if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) - c->val = git_config_bool(var, value); + if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) { + int b = git_config_maybe_bool(var, value); + if (b >= 0) + c->want = b; + else { + c->want = 1; + c->value = xstrdup(value); + } + } return 0; } @@ -35,9 +43,12 @@ int check_pager_config(const char *cmd) { struct pager_config c; c.cmd = cmd; - c.val = -1; + c.want = -1; + c.value = NULL; git_config(pager_command_config, &c); - return c.val; + if (c.value) + pager_program = c.value; + return c.want; } static void commit_pager_choice(void) { @@ -264,6 +275,10 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) use_pager = check_pager_config(p->cmd); if (use_pager == -1 && p->option & USE_PAGER) use_pager = 1; + + if ((p->option & (RUN_SETUP | RUN_SETUP_GENTLY)) && + startup_info->have_repository) /* get_git_dir() may set up repo, avoid that */ + trace_repo_setup(prefix); } commit_pager_choice(); @@ -374,6 +389,8 @@ static void handle_internal_command(int argc, const char **argv) { "receive-pack", cmd_receive_pack }, { "reflog", cmd_reflog, RUN_SETUP }, { "remote", cmd_remote, RUN_SETUP }, + { "remote-ext", cmd_remote_ext }, + { "remote-fd", cmd_remote_fd }, { "replace", cmd_replace, RUN_SETUP }, { "repo-config", cmd_config, RUN_SETUP_GENTLY }, { "rerere", cmd_rerere, RUN_SETUP },