File: git-ccdiff

package info (click to toggle)
ccdiff 0.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 633; makefile: 11
file content (37 lines) | stat: -rwxr-xr-x 682 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/pro/bin/perl

# With this file as git-ccdiff in your $PATH
#
# git config --global diff.tool ccdiff
# git config --global difftool.prompt false
# git config --global difftool.ccdiff.cmd 'ccdiff --utf-8 -u -r $LOCAL $REMOTE'
# git difftool 5c5a~..5c5a
# ->
# git ccdiff   5c5a

use 5.014002;
use warnings;

my @opt;

my @git = qw( git difftool );
for (@ARGV) {
    if (m/^-/) {	# an option
	push @opt => $_;
	}
    elsif (-f) {	# a file
	push @git => $_;
	}
    elsif (m/^[0-9a-fA-F]{4,32}$/) {		# a commit
	push @git => "$_~1..$_";
        }
    else {
	push @git => $_;
	}
    }

#use Data::Peek;
#DDumper \@ARGV;

@opt and $ENV{CCDIFF_OPTIONS} = join " " => @opt;
system @git;