Skip to content

Commit bce5a54

Browse files
committed
Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2 parents 26ccb4f + 4c2ba87 commit bce5a54

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
@@ -1663,6 +1663,11 @@ sub tie_for_persistent_memoization {
16631663
if ($memo_backend > 0) {
16641664
tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml";
16651665
} else {
1666+
# first verify that any existing file can actually be loaded
1667+
# (it may have been saved by an incompatible version)
1668+
if (-e "$path.db") {
1669+
unlink "$path.db" unless eval { retrieve("$path.db"); 1 };
1670+
}
16661671
tie %$hash => 'Memoize::Storable', "$path.db", 'nstore';
16671672
}
16681673
}

0 commit comments

Comments
 (0)