]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git.c
replace {pre,suf}fixcmp() with {starts,ends}_with()
[thirdparty/git.git] / git.c
diff --git a/git.c b/git.c
index 1188979465654248c5936e8246886341846cc6f1..3799514ccba86834ee076c66ee1b6f8473d3ebef 100644 (file)
--- a/git.c
+++ b/git.c
@@ -54,7 +54,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                /*
                 * Check remaining flags.
                 */
-               if (!prefixcmp(cmd, "--exec-path")) {
+               if (starts_with(cmd, "--exec-path")) {
                        cmd += 11;
                        if (*cmd == '=')
                                git_set_argv_exec_path(cmd + 1);
@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                                *envchanged = 1;
                        (*argv)++;
                        (*argc)--;
-               } else if (!prefixcmp(cmd, "--git-dir=")) {
+               } else if (starts_with(cmd, "--git-dir=")) {
                        setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
                        if (envchanged)
                                *envchanged = 1;
@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                                *envchanged = 1;
                        (*argv)++;
                        (*argc)--;
-               } else if (!prefixcmp(cmd, "--namespace=")) {
+               } else if (starts_with(cmd, "--namespace=")) {
                        setenv(GIT_NAMESPACE_ENVIRONMENT, cmd + 12, 1);
                        if (envchanged)
                                *envchanged = 1;
@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                                *envchanged = 1;
                        (*argv)++;
                        (*argc)--;
-               } else if (!prefixcmp(cmd, "--work-tree=")) {
+               } else if (starts_with(cmd, "--work-tree=")) {
                        setenv(GIT_WORK_TREE_ENVIRONMENT, cmd + 12, 1);
                        if (envchanged)
                                *envchanged = 1;
@@ -408,7 +408,6 @@ static void handle_internal_command(int argc, const char **argv)
                { "pack-redundant", cmd_pack_redundant, RUN_SETUP },
                { "pack-refs", cmd_pack_refs, RUN_SETUP },
                { "patch-id", cmd_patch_id },
-               { "peek-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
                { "pickaxe", cmd_blame, RUN_SETUP },
                { "prune", cmd_prune, RUN_SETUP },
                { "prune-packed", cmd_prune_packed, RUN_SETUP },
@@ -419,8 +418,8 @@ static void handle_internal_command(int argc, const char **argv)
                { "remote", cmd_remote, RUN_SETUP },
                { "remote-ext", cmd_remote_ext },
                { "remote-fd", cmd_remote_fd },
+               { "repack", cmd_repack, RUN_SETUP },
                { "replace", cmd_replace, RUN_SETUP },
-               { "repo-config", cmd_repo_config, RUN_SETUP_GENTLY },
                { "rerere", cmd_rerere, RUN_SETUP },
                { "reset", cmd_reset, RUN_SETUP },
                { "rev-list", cmd_rev_list, RUN_SETUP },
@@ -437,7 +436,6 @@ static void handle_internal_command(int argc, const char **argv)
                { "stripspace", cmd_stripspace },
                { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
                { "tag", cmd_tag, RUN_SETUP },
-               { "tar-tree", cmd_tar_tree },
                { "unpack-file", cmd_unpack_file, RUN_SETUP },
                { "unpack-objects", cmd_unpack_objects, RUN_SETUP },
                { "update-index", cmd_update_index, RUN_SETUP },
@@ -568,7 +566,7 @@ int main(int argc, char **av)
         * So we just directly call the internal command handler, and
         * die if that one cannot handle it.
         */
-       if (!prefixcmp(cmd, "git-")) {
+       if (starts_with(cmd, "git-")) {
                cmd += 4;
                argv[0] = cmd;
                handle_internal_command(argc, argv);
@@ -580,7 +578,7 @@ int main(int argc, char **av)
        argc--;
        handle_options(&argv, &argc, NULL);
        if (argc > 0) {
-               if (!prefixcmp(argv[0], "--"))
+               if (starts_with(argv[0], "--"))
                        argv[0] += 2;
        } else {
                /* The user didn't specify a command; give them help */