Debian Codegraph @

Files/git-ccdiff

raw
1 #!/pro/bin/perl
2
3 # With this file as git-ccdiff in your $PATH
4 #
5 # git config --global diff.tool ccdiff
6 # git config --global difftool.prompt false
7 # git config --global difftool.ccdiff.cmd 'ccdiff --utf-8 -u -r $LOCAL $REMOTE'
8 # git difftool 5c5a~..5c5a
9 # ->
10 # git ccdiff 5c5a
11
12 use 5.014002;
13 use warnings;
14
15 my @opt;
16
17 my @git = qw( git difftool );
18 for (@ARGV) {
19 if (m/^-/) { # an option
20 push @opt => $_;
21 }
22 elsif (-f) { # a file
23 push @git => $_;
24 }
25 elsif (m/^[0-9a-fA-F]{4,32}$/) { # a commit
26 push @git => "$_~1..$_";
27 }
28 else {
29 push @git => $_;
30 }
31 }
32
33 #use Data::Peek;
34 #DDumper \@ARGV;
35
36 @opt and $ENV{CCDIFF_OPTIONS} = join " " => @opt;
37 system @git;