Skip to content

Commit

Permalink
Item10344: looks like the problem was that Store::getRevision was ret…
Browse files Browse the repository at this point in the history
…urning (undef, 1) if the topic didn't exist - which is slightly mad

git-svn-id: http://svn.foswiki.org/trunk@10733 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Feb 18, 2011
1 parent 830c907 commit 51971bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions core/lib/Foswiki/Meta.pm
Expand Up @@ -445,12 +445,14 @@ sub load {
return $m if (defined($m));
}

ASSERT( not ($this->{_latestIsLoaded}) ) if DEBUG;

my $loadedRev = $this->loadVersion($rev);
#insane as this seems, load can fail to load, but will give you some kind of valid seeming Meta obecjt.
if (not defined($loadedRev)) {
ASSERT( not defined( $this->{_loadedRev} ) ) if DEBUG;
#_latestIsloaded is mostly undef when the topic is not ondisk, except Fn_SEARCH::verify_refQuery_ForkingSearch and friends
#ASSERT( not defined($this->{_latestIsLoaded}) ) if DEBUG;
#_latestIsloaded is mostly undef / 0 when the topic is not ondisk, except Fn_SEARCH::verify_refQuery_ForkingSearch and friends
ASSERT( not ($this->{_latestIsLoaded}) ) if DEBUG;
} else {
ASSERT( defined( $this->{_loadedRev} ) and ($this->{_loadedRev} >0)) if DEBUG;
ASSERT( defined($this->{_latestIsLoaded}) ) if DEBUG;
Expand Down Expand Up @@ -1017,6 +1019,9 @@ sub loadVersion {
$this->{_text} = '' unless defined $this->{_text};

$this->addDependency();
} else {
#we didn't load, so how could it be latest?
ASSERT(not $this->{_latestIsLoaded}) if DEBUG;
}

return $this->{_loadedRev};
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Store/VC/Handler.pm
Expand Up @@ -433,7 +433,7 @@ sub getRevision {
if ( -e $this->{file} ) {
return (readFile( $this, $this->{file} ), 1 );
}
return (undef, 1);
return (undef, 0);
}

=begin TML
Expand Down
2 changes: 2 additions & 0 deletions core/lib/Foswiki/Store/VC/Store.pm
Expand Up @@ -84,6 +84,7 @@ sub readTopic {
if (defined($gotRev) and ($gotRev > 0)) {
return ($gotRev, $isLatest)
}
ASSERT(not $isLatest) if DEBUG;

my $handler = $this->getHandler($topicObject);
$isLatest = 0;
Expand All @@ -97,6 +98,7 @@ sub readTopic {

(my $text, $isLatest) = $handler->getRevision($version);
unless (defined $text) {
ASSERT(not $isLatest) if DEBUG;
return (undef, $isLatest)
}

Expand Down

0 comments on commit 51971bb

Please sign in to comment.