Skip to content

Commit 535c45f

Browse files
committed
Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2 parents 05ce5ac + 166c010 commit 535c45f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

perl/Git/SVN.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,11 @@ sub tie_for_persistent_memoization {
16531653
if ($memo_backend > 0) {
16541654
tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml";
16551655
} else {
1656+
# first verify that any existing file can actually be loaded
1657+
# (it may have been saved by an incompatible version)
1658+
if (-e "$path.db") {
1659+
unlink "$path.db" unless eval { retrieve("$path.db"); 1 };
1660+
}
16561661
tie %$hash => 'Memoize::Storable', "$path.db", 'nstore';
16571662
}
16581663
}

0 commit comments

Comments
 (0)