diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-27 15:04:08 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-27 15:04:08 -0700 |
commit | a3228e4a4a621b63419c3e936211a7e1c9cb67a9 (patch) | |
tree | 112051c106f5514d52bc1f31efb18cf9524d3a8c /perl | |
parent | Merge branch 'svn-wt' of git://bogomips.org/git-svn (diff) | |
parent | git-svn: do not reuse caches memoized for a different architecture (diff) | |
download | tgif-a3228e4a4a621b63419c3e936211a7e1c9cb67a9.tar.xz |
Merge branch 'svn-cache' of git://bogomips.org/git-svn
* 'svn-cache' of git://bogomips.org/git-svn:
git-svn: do not reuse caches memoized for a different architecture
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Git/SVN.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 499e84b6d6..711d2687a3 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -1663,7 +1663,17 @@ sub tie_for_persistent_memoization { if ($memo_backend > 0) { tie %$hash => 'Git::SVN::Memoize::YAML', "$path.yaml"; } else { - tie %$hash => 'Memoize::Storable', "$path.db", 'nstore'; + # first verify that any existing file can actually be loaded + # (it may have been saved by an incompatible version) + my $db = "$path.db"; + if (-e $db) { + use Storable qw(retrieve); + + if (!eval { retrieve($db); 1 }) { + unlink $db or die "unlink $db failed: $!"; + } + } + tie %$hash => 'Memoize::Storable', $db, 'nstore'; } } |