forked from pflanze/chj-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_cj-git-diff
executable file
·92 lines (72 loc) · 1.74 KB
/
_cj-git-diff
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/perl -w
# Wed Sep 24 22:24:27 CEST 2008
(my $email='XXX%YYY,ch')=~ tr/%,/@./;
use strict;
$0=~ /(.*?)([^\/]+)\z/s or die "?";
my ($mydir, $myname)=($1,$2);
sub usage {
print STDERR map{"$_\n"} @_ if @_;
print "$myname ..
To be used with Git, as custom diff driver, see man gitattributes
(or the --ext-diff option in man git-diff).
HM WELL. .gitconfig doesn't work. Use it as such:
GIT_EXTERNAL_DIFF=_cj-git-diff CJ_GIT_DIFF_CMD=tkdiff g-diff
grr really.(not even --ext-diff option necessary now.)
(This is with git version 1.6.0)
(Christian Jaeger <$email>)
";
exit (@_ ? 1 : 0);
}
our ($file2,
$file1,
$_sha1_1,
$_perms_X,
$_hmunknownwhyagainfile2,
$_sha1_2,
$_perms_Y,
$_arg1,
$_arg2,
$_wording,
);
if (@ARGV==7) {
($file2,
$file1,
$_sha1_1,
$_perms_X,
$_hmunknownwhyagainfile2,
$_sha1_2,
$_perms_Y
)= @ARGV;
} elsif (@ARGV==9) {
(
$_arg1,
$file1,
$_sha1_1,
$_perms_X,
$file2,
$_sha1_2,
$_perms_Y,
$_arg2,
$_wording,
)= @ARGV;
} else {
require Data::Dumper;
usage "got ".@ARGV." arguments.\n"
.Data::Dumper::Dumper(@ARGV);
}
use Chj::xperlfunc;
my $cmd= $ENV{CJ_GIT_DIFF_CMD} // die "CJ_GIT_DIFF_CMD env var is not set";
# XX split $cmd according to shell rules? ?
xsystem $cmd, $file1,$file2;
# ^ instead of xexec, since git diff issues a warning if we don't exit true.
#use Chj::ruse;
#use Chj::Backtrace; use Chj::repl; repl;
__END__
Example:
$VAR1 = 'Einfuehrung.txt';
$VAR2 = '/tmp/.diff_BkEzS9';
$VAR3 = 'b5012aea677ff412f452afe6ba1e3dbd608c3fb9';
$VAR4 = '100644';
$VAR5 = 'Einfuehrung.txt';
$VAR6 = '0000000000000000000000000000000000000000';
$VAR7 = '100644';