diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 06:41:49 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 06:42:46 +0200 |
commit | 4d8618c208f0637321d153821c587f6e35959322 (patch) | |
tree | 28688ad8c1374cd8ac420e15142f78ef585ff4a6 /lib | |
parent | d737f0e7bc48921960d8a101c4e8d17ec414896a (diff) |
Add hashl -f update (update with unignore)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App/Hashl.pm | 17 |
1 files changed, 11 insertions, 6 deletions
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; } |