From: Junio C Hamano Date: Mon, 29 Aug 2011 04:19:25 +0000 (-0700) Subject: Merge branch 'jk/pager-with-external-command' X-Git-Tag: v1.7.7-rc1~37 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b?hp=-c Merge branch 'jk/pager-with-external-command' * jk/pager-with-external-command: support pager.* for external commands --- 67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b diff --combined git.c index b660e36660,bb5205e4dd..8e34903a65 --- a/git.c +++ b/git.c @@@ -7,8 -7,8 +7,8 @@@ const char git_usage_string[] = "git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path]\n" - " [-p|--paginate|--no-pager] [--no-replace-objects]\n" - " [--bare] [--git-dir=] [--work-tree=]\n" + " [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]\n" + " [--git-dir=] [--work-tree=] [--namespace=]\n" " [-c name=value] [--help]\n" " []"; @@@ -126,20 -126,6 +126,20 @@@ static int handle_options(const char ** setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1); if (envchanged) *envchanged = 1; + } else if (!strcmp(cmd, "--namespace")) { + if (*argc < 2) { + fprintf(stderr, "No namespace given for --namespace.\n" ); + usage(git_usage_string); + } + setenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1); + if (envchanged) + *envchanged = 1; + (*argv)++; + (*argc)--; + } else if (!prefixcmp(cmd, "--namespace=")) { + setenv(GIT_NAMESPACE_ENVIRONMENT, cmd + 12, 1); + if (envchanged) + *envchanged = 1; } else if (!strcmp(cmd, "--work-tree")) { if (*argc < 2) { fprintf(stderr, "No directory given for --work-tree.\n" ); @@@ -197,6 -183,8 +197,6 @@@ static int handle_alias(int *argcp, con if (alias_string[0] == '!') { const char **alias_argv; int argc = *argcp, i; - struct strbuf sb = STRBUF_INIT; - const char *env[2]; commit_pager_choice(); @@@ -207,7 -195,13 +207,7 @@@ alias_argv[i] = (*argv)[i]; alias_argv[argc] = NULL; - strbuf_addstr(&sb, "GIT_PREFIX="); - if (subdir) - strbuf_addstr(&sb, subdir); - env[0] = sb.buf; - env[1] = NULL; - ret = run_command_v_opt_cd_env(alias_argv, RUN_USING_SHELL, NULL, env); - strbuf_release(&sb); + ret = run_command_v_opt(alias_argv, RUN_USING_SHELL); if (ret >= 0) /* normal exit */ exit(ret); @@@ -334,7 -328,7 +334,7 @@@ static void handle_internal_command(in { "annotate", cmd_annotate, RUN_SETUP }, { "apply", cmd_apply, RUN_SETUP_GENTLY }, { "archive", cmd_archive }, - { "bisect--helper", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE }, + { "bisect--helper", cmd_bisect__helper, RUN_SETUP }, { "blame", cmd_blame, RUN_SETUP }, { "branch", cmd_branch, RUN_SETUP }, { "bundle", cmd_bundle, RUN_SETUP_GENTLY }, @@@ -473,6 -467,8 +473,8 @@@ static void execv_dashed_external(cons const char *tmp; int status; + if (use_pager == -1) + use_pager = check_pager_config(argv[0]); commit_pager_choice(); strbuf_addf(&cmd, "git-%s", argv[0]);