summaryrefslogtreecommitdiff
path: root/lib/App
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-05-18 17:59:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-05-18 17:59:19 +0200
commit65de69067277479c3f8e011098ca4ce70df8267a (patch)
treea6b057ce387d79fbc9bd50c09f6e8b50529fe6e0 /lib/App
parent4163cb4083ff80ef8f3a52e2444a424ee12e2321 (diff)
If ignored files are still present, do not re-add them while updating
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/Hashl.pm22
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>)