From 2f78c9a8bd17140b63114a844fa9c23e22489d80 Mon Sep 17 00:00:00 2001 From: John Ankarstrom Date: Sat, 3 Jul 2021 21:27:05 +0200 Subject: Add 'git-bdiff' utility --- git-bdiff | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 git-bdiff diff --git a/git-bdiff b/git-bdiff new file mode 100755 index 0000000..9b39ad4 --- /dev/null +++ b/git-bdiff @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +# git-bdiff -- fake compare binary files + +use strict; +use warnings; + +my $i; + +if (@ARGV == 1) { + $i = 0; +} elsif (@ARGV == 7) { + $i = 4; +} else { + die <) { + # explicit + if (/^\Q$target\E:\s*(.*)/) { + push @deps, "$repo/$path$_" for split /\s/, $1; + last; + } + # implicit + if (/^\.([^ .]+)\.\Q$ext\E\s*:\s*(.*)/) { + push @deps, "$repo/$path$basename.$1"; + push @deps, "$repo/$path$_" for split /\s/, $2; + last; + } +} +close $f; +die "no dependencies found, cannot compare\n" if not @deps; + +$i = 0; +for (`git diff HEAD -- @deps`) { + print if @ARGV == 7; + $i = 1; +} +exit $i if @ARGV == 1; -- cgit v1.2.3