difftool: retire the scripted version

It served its purpose, but now we have a builtin difftool. Time for the
Perl script to enjoy Florida.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin
2017-01-19 21:30:40 +01:00
committed by Junio C Hamano
parent 03831ef7b5
commit 019678d6b1
6 changed files with 47 additions and 97 deletions

View File

@ -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,23 +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);