Skip to content

Commit

Permalink
Retire the scripted difftool
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dscho committed Jan 19, 2017
1 parent 8ab7568 commit 1524ca7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 97 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -76,7 +76,6 @@
/git-init-db
/git-interpret-trailers
/git-instaweb
/git-legacy-difftool
/git-log
/git-ls-files
/git-ls-remote
Expand Down
1 change: 0 additions & 1 deletion Makefile
Expand Up @@ -522,7 +522,6 @@ SCRIPT_LIB += git-sh-setup
SCRIPT_LIB += git-sh-i18n

SCRIPT_PERL += git-add--interactive.perl
SCRIPT_PERL += git-legacy-difftool.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
Expand Down
41 changes: 0 additions & 41 deletions builtin/difftool.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
File renamed without changes.
7 changes: 1 addition & 6 deletions git.c
Expand Up @@ -424,12 +424,7 @@ static struct cmd_struct commands[] = {
{ "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
{ "diff-index", cmd_diff_index, RUN_SETUP },
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
/*
* NEEDSWORK: Once the redirection to git-legacy-difftool.perl in
* builtin/difftool.c has been removed, this entry should be changed to
* RUN_SETUP | NEED_WORK_TREE
*/
{ "difftool", cmd_difftool },
{ "difftool", cmd_difftool, RUN_SETUP | NEED_WORK_TREE },
{ "fast-export", cmd_fast_export, RUN_SETUP },
{ "fetch", cmd_fetch, RUN_SETUP },
{ "fetch-pack", cmd_fetch_pack, RUN_SETUP },
Expand Down

0 comments on commit 1524ca7

Please sign in to comment.