Skip to content

Commit 019678d

Browse files
dschogitster
authored andcommitted
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>
1 parent 03831ef commit 019678d

6 files changed

Lines changed: 47 additions & 97 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
/git-init-db
7777
/git-interpret-trailers
7878
/git-instaweb
79-
/git-legacy-difftool
8079
/git-log
8180
/git-ls-files
8281
/git-ls-remote

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ SCRIPT_LIB += git-sh-setup
527527
SCRIPT_LIB += git-sh-i18n
528528

529529
SCRIPT_PERL += git-add--interactive.perl
530-
SCRIPT_PERL += git-legacy-difftool.perl
531530
SCRIPT_PERL += git-archimport.perl
532531
SCRIPT_PERL += git-cvsexportcommit.perl
533532
SCRIPT_PERL += git-cvsimport.perl

builtin/difftool.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -616,30 +616,6 @@ static int run_file_diff(int prompt, const char *prefix,
616616
exit(ret);
617617
}
618618

619-
/*
620-
* NEEDSWORK: this function can go once the legacy-difftool Perl script is
621-
* retired.
622-
*
623-
* We intentionally avoid reading the config directly here, to avoid messing up
624-
* the GIT_* environment variables when we need to fall back to exec()ing the
625-
* Perl script.
626-
*/
627-
static int use_builtin_difftool(void) {
628-
struct child_process cp = CHILD_PROCESS_INIT;
629-
struct strbuf out = STRBUF_INIT;
630-
int ret;
631-
632-
argv_array_pushl(&cp.args,
633-
"config", "--bool", "difftool.usebuiltin", NULL);
634-
cp.git_cmd = 1;
635-
if (capture_command(&cp, &out, 6))
636-
return 0;
637-
strbuf_trim(&out);
638-
ret = !strcmp("true", out.buf);
639-
strbuf_release(&out);
640-
return ret;
641-
}
642-
643619
int cmd_difftool(int argc, const char **argv, const char *prefix)
644620
{
645621
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)
671647
OPT_END()
672648
};
673649

674-
/*
675-
* NEEDSWORK: Once the builtin difftool has been tested enough
676-
* and git-legacy-difftool.perl is retired to contrib/, this preamble
677-
* can be removed.
678-
*/
679-
if (!use_builtin_difftool()) {
680-
const char *path = mkpath("%s/git-legacy-difftool",
681-
git_exec_path());
682-
683-
if (sane_execvp(path, (char **)argv) < 0)
684-
die_errno("could not exec %s", path);
685-
686-
return 0;
687-
}
688-
prefix = setup_git_directory();
689-
trace_repo_setup(prefix);
690-
setup_work_tree();
691650
/* NEEDSWORK: once we no longer spawn anything, remove this */
692651
setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
693652
setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);

git.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,7 @@ static struct cmd_struct commands[] = {
424424
{ "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
425425
{ "diff-index", cmd_diff_index, RUN_SETUP },
426426
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
427-
/*
428-
* NEEDSWORK: Once the redirection to git-legacy-difftool.perl in
429-
* builtin/difftool.c has been removed, this entry should be changed to
430-
* RUN_SETUP | NEED_WORK_TREE
431-
*/
432-
{ "difftool", cmd_difftool },
427+
{ "difftool", cmd_difftool, RUN_SETUP | NEED_WORK_TREE },
433428
{ "fast-export", cmd_fast_export, RUN_SETUP },
434429
{ "fetch", cmd_fetch, RUN_SETUP },
435430
{ "fetch-pack", cmd_fetch_pack, RUN_SETUP },

0 commit comments

Comments
 (0)