-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path_cj-git-gconfdiff
More file actions
executable file
·74 lines (59 loc) · 1.28 KB
/
_cj-git-gconfdiff
File metadata and controls
executable file
·74 lines (59 loc) · 1.28 KB
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
#!/usr/bin/perl -w
use strict;
our @diff=("diff","-u");
$0=~ /(.*?)([^\/]+)\z/s or die "?";
my ($mydir, $myname)=($1,$2);
sub usage {
print STDERR map{"$_\n"} @_ if @_;
print "$myname ..
adapted COPY from _cj-git-tkdiff, see there
";
exit (@_ ? 1 : 0);
}
usage unless @ARGV==7;
our ($file2,
$file1,
$sha1_1,
$perms_X,
$hmunknownwhyagainfile2,
$sha1_2,
$perms_Y
)= @ARGV;
use Chj::xperlfunc;
use Chj::xtmpfile;
use Chj::xopen 'xopen_read';
use Chj::IO::MD5;
sub filter_file {
my ($file)=@_;
if (-e $file) {
my $in= xopen_read $file;
my $out= xtmpfile;
while (<$in>) {
s/mtime="\d{10}"/mtime="<REMOVED-BY-$myname>"/sg;
$out->xprint($_);
}
$in->xclose;
$out->xclose;
$out
} else {
xopen_read "/dev/null"
#hehe, need an object with a path method, incidentally that works nicely
}
}
our ($file1_,$file2_)=($file1,$file2);
our @f= map { filter_file $_ } ($file1,$file2);
our @p= map { $_->path } @f;
sub md5 {
my ($path)=@_;
my $f= xopen_read $path;
my $r= $f->Chj::IO::MD5::md5;
$f->xclose;
$r
}
our @m= map { md5 $_ } @p;
if ($m[0] ne $m[1]) {
print "@diff $file1_ $file2_\n"
or die $!;
xsystem @diff, @p;
# ^ instead of xexec, since git diff issues a warning if we don't exit true.
}