X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Debian%2FDgit.pm;h=2555812c46abcdd1c617e718b0cb1c5643e8e0ba;hb=71350fe30f7449b24dc2884b42cc5ff50a2bf84e;hp=fa85374150288cc53a1ef363042262315b76ab52;hpb=9acb31a971d4f653836bbcf07410f51d3f80dbdd;p=dgit.git diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index fa853741..2555812c 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -8,6 +8,7 @@ use warnings; use POSIX; use IO::Handle; use Config; +use Digest::SHA; BEGIN { use Exporter (); @@ -18,6 +19,7 @@ BEGIN { @EXPORT = qw(setup_sigwarn debiantag server_branch server_ref stat_exists link_ltarget + hashfile fail ensuredir executable_on_path waitstatusmsg failedcmd cmdoutput cmdoutput_errok @@ -229,6 +231,13 @@ sub link_ltarget ($$) { link $old, $new or die "link $old $new: $!"; } +sub hashfile ($) { + my ($fn) = @_; + my $h = Digest::SHA->new(256); + $h->addfile($fn); + return $h->hexdigest(); +} + sub git_rev_parse ($) { return cmdoutput qw(git rev-parse), "$_[0]~0"; }