Skip to content

Commit 6f31dcc

Browse files
committed
Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2 parents b03f959 + 7fd713f commit 6f31dcc

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
@@ -1585,6 +1585,11 @@ sub tie_for_persistent_memoization {
15851585
if ($memo_backend > 0) {
15861586
tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml";
15871587
} else {
1588+
# first verify that any existing file can actually be loaded
1589+
# (it may have been saved by an incompatible version)
1590+
if (-e "$path.db") {
1591+
unlink "$path.db" unless eval { retrieve("$path.db"); 1 };
1592+
}
15881593
tie %$hash => 'Memoize::Storable', "$path.db", 'nstore';
15891594
}
15901595
}

0 commit comments

Comments
 (0)