Skip to content

Commit

Permalink
Merge pull request #246 from uecasm/patch-1
Browse files Browse the repository at this point in the history
Verify memoized files can be reloaded before using them
  • Loading branch information
dscho committed Jul 18, 2015
2 parents 2f7e7bb + 66f3783 commit 43f871f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions perl/Git/SVN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,11 @@ sub tie_for_persistent_memoization {
if ($memo_backend > 0) {
tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml";
} else {
# first verify that any existing file can actually be loaded
# (it may have been saved by an incompatible version)
if (-e "$path.db") {
unlink "$path.db" unless eval { retrieve("$path.db"); 1 };
}
tie %$hash => 'Memoize::Storable', "$path.db", 'nstore';
}
}
Expand Down

0 comments on commit 43f871f

Please sign in to comment.