summaryrefslogtreecommitdiff
path: root/lib/App
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-05-23 06:41:49 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-05-23 06:42:46 +0200
commit4d8618c208f0637321d153821c587f6e35959322 (patch)
tree28688ad8c1374cd8ac420e15142f78ef585ff4a6 /lib/App
parentd737f0e7bc48921960d8a101c4e8d17ec414896a (diff)
Add hashl -f update (update with unignore)
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/Hashl.pm17
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;
}