builtin/fmt-merge-message: convert to struct object_id
[gitweb.git] / builtin / difftool.c
index 2115e548a50e8fdf32bbbd940d83dfb239e84868..d13350ce832cd8c0064c8a5b2d3c9be64f876b8d 100644 (file)
@@ -567,7 +567,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                                warning(_("both files modified: '%s' and '%s'."),
                                        wtdir.buf, rdir.buf);
                                warning(_("working tree file has been left."));
-                               warning("");
+                               warning("%s", "");
                                err = 1;
                        } else if (unlink(wtdir.buf) ||
                                   copy_file(wtdir.buf, rdir.buf, st.st_mode))
@@ -616,30 +616,6 @@ static int run_file_diff(int prompt, const char *prefix,
        exit(ret);
 }
 
-/*
- * NEEDSWORK: this function can go once the legacy-difftool Perl script is
- * retired.
- *
- * We intentionally avoid reading the config directly here, to avoid messing up
- * the GIT_* environment variables when we need to fall back to exec()ing the
- * Perl script.
- */
-static int use_builtin_difftool(void) {
-       struct child_process cp = CHILD_PROCESS_INIT;
-       struct strbuf out = STRBUF_INIT;
-       int ret;
-
-       argv_array_pushl(&cp.args,
-                        "config", "--bool", "difftool.usebuiltin", NULL);
-       cp.git_cmd = 1;
-       if (capture_command(&cp, &out, 6))
-               return 0;
-       strbuf_trim(&out);
-       ret = !strcmp("true", out.buf);
-       strbuf_release(&out);
-       return ret;
-}
-
 int cmd_difftool(int argc, const char **argv, const char *prefix)
 {
        int use_gui_tool = 0, dir_diff = 0, prompt = -1, symlinks = 0,
@@ -671,27 +647,6 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
-       /*
-        * NEEDSWORK: Once the builtin difftool has been tested enough
-        * and git-legacy-difftool.perl is retired to contrib/, this preamble
-        * can be removed.
-        */
-       if (!use_builtin_difftool()) {
-               const char *path = mkpath("%s/git-legacy-difftool",
-                                         git_exec_path());
-
-               if (sane_execvp(path, (char **)argv) < 0)
-                       die_errno("could not exec %s", path);
-
-               return 0;
-       }
-       prefix = setup_git_directory();
-       trace_repo_setup(prefix);
-       setup_work_tree();
-       /* NEEDSWORK: once we no longer spawn anything, remove this */
-       setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
-       setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);
-
        git_config(difftool_config, NULL);
        symlinks = has_symlinks;
 
@@ -702,6 +657,10 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
        if (tool_help)
                return print_tool_help();
 
+       /* NEEDSWORK: once we no longer spawn anything, remove this */
+       setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
+       setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);
+
        if (use_gui_tool && diff_gui_tool && *diff_gui_tool)
                setenv("GIT_DIFF_TOOL", diff_gui_tool, 1);
        else if (difftool_cmd) {