From 4d8618c208f0637321d153821c587f6e35959322 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 23 May 2011 06:41:49 +0200 Subject: Add hashl -f update (update with unignore) --- lib/App/Hashl.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm index da06693..f1fc299 100644 --- a/lib/App/Hashl.pm +++ b/lib/App/Hashl.pm @@ -112,9 +112,9 @@ sub files { } sub add_file { - my ( $self, %data ) = @_; - my $file = $data{file}; - my $path = $data{path}; + my ( $self, %opt ) = @_; + my $file = $opt{file}; + my $path = $opt{path}; my ( $size, $mtime ) = ( stat($path) )[ 7, 9 ]; if ( $self->file($file) @@ -127,7 +127,12 @@ sub add_file { my $hash = $self->hash_file($path); if ( $self->{ignored}->{$hash} ) { - return; + if ( $opt{unignore} ) { + $self->unignore($hash); + } + else { + return; + } } $self->{files}->{$file} = { @@ -159,9 +164,9 @@ sub ignore { } sub unignore { - my ( $self, $path ) = @_; + my ( $self, $hash ) = @_; - delete $self->{ignored}->{ $self->hash_file($path) }; + delete $self->{ignored}->{$hash}; return 1; } -- cgit v1.2.3