]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git.c
read-tree: add "--super-prefix" option, eliminate global
[thirdparty/git.git] / git.c
diff --git a/git.c b/git.c
index 10202a7f126aba88c41c51e140f8c0aa0b148c02..32a5be68a17064ca1b773675761e33e30bf4056b 100644 (file)
--- a/git.c
+++ b/git.c
@@ -14,9 +14,8 @@
  * RUN_SETUP for reading from the configuration file.
  */
 #define NEED_WORK_TREE         (1<<3)
-#define SUPPORT_SUPER_PREFIX   (1<<4)
-#define DELAY_PAGER_CONFIG     (1<<5)
-#define NO_PARSEOPT            (1<<6) /* parse-options is not used */
+#define DELAY_PAGER_CONFIG     (1<<4)
+#define NO_PARSEOPT            (1<<5) /* parse-options is not used */
 
 struct cmd_struct {
        const char *cmd;
@@ -29,8 +28,7 @@ const char git_usage_string[] =
           "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
           "           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n"
           "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-          "           [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-          "           <command> [<args>]");
+          "           [--config-env=<name>=<envvar>] <command> [<args>]");
 
 const char git_more_info_string[] =
        N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -226,20 +224,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                        setenv(GIT_WORK_TREE_ENVIRONMENT, cmd, 1);
                        if (envchanged)
                                *envchanged = 1;
-               } else if (!strcmp(cmd, "--super-prefix")) {
-                       if (*argc < 2) {
-                               fprintf(stderr, _("no prefix given for --super-prefix\n" ));
-                               usage(git_usage_string);
-                       }
-                       setenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);
-                       if (envchanged)
-                               *envchanged = 1;
-                       (*argv)++;
-                       (*argc)--;
-               } else if (skip_prefix(cmd, "--super-prefix=", &cmd)) {
-                       setenv(GIT_SUPER_PREFIX_ENVIRONMENT, cmd, 1);
-                       if (envchanged)
-                               *envchanged = 1;
                } else if (!strcmp(cmd, "--bare")) {
                        char *cwd = xgetcwd();
                        is_bare_repository_cfg = 1;
@@ -449,11 +433,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
                trace_repo_setup(prefix);
        commit_pager_choice();
 
-       if (!help && get_super_prefix()) {
-               if (!(p->option & SUPPORT_SUPER_PREFIX))
-                       die(_("%s doesn't support --super-prefix"), p->cmd);
-       }
-
        if (!help && p->option & NEED_WORK_TREE)
                setup_work_tree();
 
@@ -492,7 +471,7 @@ static struct cmd_struct commands[] = {
        { "annotate", cmd_annotate, RUN_SETUP },
        { "apply", cmd_apply, RUN_SETUP_GENTLY },
        { "archive", cmd_archive, RUN_SETUP_GENTLY },
-       { "bisect--helper", cmd_bisect__helper, RUN_SETUP },
+       { "bisect", cmd_bisect, RUN_SETUP },
        { "blame", cmd_blame, RUN_SETUP },
        { "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG },
        { "bugreport", cmd_bugreport, RUN_SETUP_GENTLY },
@@ -504,7 +483,7 @@ static struct cmd_struct commands[] = {
        { "check-ref-format", cmd_check_ref_format, NO_PARSEOPT  },
        { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
        { "checkout--worker", cmd_checkout__worker,
-               RUN_SETUP | NEED_WORK_TREE | SUPPORT_SUPER_PREFIX },
+               RUN_SETUP | NEED_WORK_TREE },
        { "checkout-index", cmd_checkout_index,
                RUN_SETUP | NEED_WORK_TREE},
        { "cherry", cmd_cherry, RUN_SETUP },
@@ -539,7 +518,7 @@ static struct cmd_struct commands[] = {
        { "format-patch", cmd_format_patch, RUN_SETUP },
        { "fsck", cmd_fsck, RUN_SETUP },
        { "fsck-objects", cmd_fsck, RUN_SETUP },
-       { "fsmonitor--daemon", cmd_fsmonitor__daemon, SUPPORT_SUPER_PREFIX | RUN_SETUP },
+       { "fsmonitor--daemon", cmd_fsmonitor__daemon, RUN_SETUP },
        { "gc", cmd_gc, RUN_SETUP },
        { "get-tar-commit-id", cmd_get_tar_commit_id, NO_PARSEOPT },
        { "grep", cmd_grep, RUN_SETUP_GENTLY },
@@ -583,7 +562,7 @@ static struct cmd_struct commands[] = {
        { "pull", cmd_pull, RUN_SETUP | NEED_WORK_TREE },
        { "push", cmd_push, RUN_SETUP },
        { "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER },
-       { "read-tree", cmd_read_tree, RUN_SETUP | SUPPORT_SUPER_PREFIX},
+       { "read-tree", cmd_read_tree, RUN_SETUP },
        { "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE },
        { "receive-pack", cmd_receive_pack },
        { "reflog", cmd_reflog, RUN_SETUP },
@@ -610,7 +589,7 @@ static struct cmd_struct commands[] = {
        { "stash", cmd_stash, RUN_SETUP | NEED_WORK_TREE },
        { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
        { "stripspace", cmd_stripspace },
-       { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX },
+       { "submodule--helper", cmd_submodule__helper, RUN_SETUP },
        { "switch", cmd_switch, RUN_SETUP | NEED_WORK_TREE },
        { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
        { "tag", cmd_tag, RUN_SETUP | DELAY_PAGER_CONFIG },
@@ -727,9 +706,6 @@ static void execv_dashed_external(const char **argv)
        struct child_process cmd = CHILD_PROCESS_INIT;
        int status;
 
-       if (get_super_prefix())
-               die(_("%s doesn't support --super-prefix"), argv[0]);
-
        if (use_pager == -1 && !is_builtin(argv[0]))
                use_pager = check_pager_config(argv[0]);
        commit_pager_choice();
@@ -799,9 +775,6 @@ static int run_argv(int *argcp, const char ***argv)
                         */
                        trace2_cmd_name("_run_git_alias_");
 
-                       if (get_super_prefix())
-                               die("%s doesn't support --super-prefix", **argv);
-
                        commit_pager_choice();
 
                        strvec_push(&cmd.args, "git");