Skip to content

Commit 3b79bb0

Browse files
committed
Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2 parents 1f657a8 + 43c1c62 commit 3b79bb0

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
@@ -1658,6 +1658,11 @@ sub tie_for_persistent_memoization {
16581658
if ($memo_backend > 0) {
16591659
tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml";
16601660
} else {
1661+
# first verify that any existing file can actually be loaded
1662+
# (it may have been saved by an incompatible version)
1663+
if (-e "$path.db") {
1664+
unlink "$path.db" unless eval { retrieve("$path.db"); 1 };
1665+
}
16611666
tie %$hash => 'Memoize::Storable', "$path.db", 'nstore';
16621667
}
16631668
}

0 commit comments

Comments
 (0)