diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2011-05-18 17:59:19 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-18 17:59:19 +0200 | 
| commit | 65de69067277479c3f8e011098ca4ce70df8267a (patch) | |
| tree | a6b057ce387d79fbc9bd50c09f6e8b50529fe6e0 /lib | |
| parent | 4163cb4083ff80ef8f3a52e2444a424ee12e2321 (diff) | |
If ignored files are still present, do not re-add them while updating
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/App/Hashl.pm | 22 | 
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm index c0b7e8c..e8015b2 100644 --- a/lib/App/Hashl.pm +++ b/lib/App/Hashl.pm @@ -128,12 +128,8 @@ Otherwise, returns undef.  sub hash_in_db {  	my ($self, $hash) = @_; -	if ($self->{ignored}->{hashes}) { -		for my $ihash (@{$self->{ignored}->{hashes}}) { -			if ($hash eq $ihash) { -				return '// ignored'; -			} -		} +	if ($self->{ignored}->{$hash}) { +		return '// ignored';  	}  	for my $name ($self->files()) { @@ -241,8 +237,14 @@ sub add_file {  		return;  	} +	my $hash = $self->hash_file($path); + +	if ($self->{ignored}->{$hash}) { +		return; +	} +  	$self->{files}->{$file} = { -		hash  => $self->hash_file($path), +		hash  => $hash,  		mtime => $mtime,  		size  => $size,  	}; @@ -256,8 +258,8 @@ Returns a list of all ignored file hashes  sub ignored {  	my ($self) = @_; -	if (exists $self->{ignored}->{hashes}) { -		return @{ $self->{ignored}->{hashes} }; +	if (exists $self->{ignored}) { +		return keys %{ $self->{ignored} };  	}  	else {  		return (); @@ -275,7 +277,7 @@ sub ignore {  	my ($self, $file, $path) = @_;  	$self->delete_file($file); -	push(@{ $self->{ignored}->{hashes} }, $self->hash_file($path)); +	$self->{ignored}->{ $self->hash_file($path) } = 1;  }  =item $hashl->save(I<$file>)  | 
