diff options
author | David Aguilar <davvid@gmail.com> | 2009-04-07 10:21:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-04-08 07:19:56 +0200 |
commit | afcbc8e7ecb18a3ee542e808f02f5df7d56d5bdc (patch) | |
tree | 6a057ce275aa7d4998846e21452c84616357f6b0 /contrib/difftool/git-difftool | |
parent | difftool/mergetool: add diffuse as merge and diff tool (diff) | |
download | git-afcbc8e7ecb18a3ee542e808f02f5df7d56d5bdc.tar.xz git-afcbc8e7ecb18a3ee542e808f02f5df7d56d5bdc.zip |
difftool: move 'git-difftool' out of contrib
This prepares 'git-difftool' and its documentation for
mainstream use.
'git-difftool-helper' became 'git-difftool--helper'
since users should not use it directly.
'git-difftool' was added to the list of commands as
an ancillaryinterrogator.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/difftool/git-difftool')
-rwxr-xr-x | contrib/difftool/git-difftool | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/contrib/difftool/git-difftool b/contrib/difftool/git-difftool deleted file mode 100755 index 8c160e5bb4..0000000000 --- a/contrib/difftool/git-difftool +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env perl -# Copyright (c) 2009 David Aguilar -# -# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible -# git-difftool-helper script. This script exports -# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and -# GIT_DIFFTOOL_NO_PROMPT and GIT_DIFF_TOOL for use by git-difftool-helper. -# Any arguments that are unknown to this script are forwarded to 'git diff'. - -use strict; -use warnings; -use Cwd qw(abs_path); -use File::Basename qw(dirname); - -my $DIR = abs_path(dirname($0)); - - -sub usage -{ - print << 'USAGE'; -usage: git difftool [--tool=<tool>] [-y|--no-prompt] ["git diff" options] -USAGE - exit 1; -} - -sub setup_environment -{ - $ENV{PATH} = "$DIR:$ENV{PATH}"; - $ENV{GIT_PAGER} = ''; - $ENV{GIT_EXTERNAL_DIFF} = 'git-difftool-helper'; -} - -sub exe -{ - my $exe = shift; - if ($^O eq 'MSWin32' || $^O eq 'msys') { - return "$exe.exe"; - } - return $exe; -} - -sub generate_command -{ - my @command = (exe('git'), 'diff'); - my $skip_next = 0; - my $idx = -1; - for my $arg (@ARGV) { - $idx++; - if ($skip_next) { - $skip_next = 0; - next; - } - if ($arg eq '-t' || $arg eq '--tool') { - usage() if $#ARGV <= $idx; - $ENV{GIT_DIFF_TOOL} = $ARGV[$idx + 1]; - $skip_next = 1; - next; - } - if ($arg =~ /^--tool=/) { - $ENV{GIT_DIFF_TOOL} = substr($arg, 7); - next; - } - if ($arg eq '-y' || $arg eq '--no-prompt') { - $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true'; - next; - } - if ($arg eq '-h' || $arg eq '--help') { - usage(); - } - push @command, $arg; - } - return @command -} - -setup_environment(); -exec(generate_command()); |