From 5d88146861ac237ac89cbed2e90a985b9c3bfdc2 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Wed, 4 Aug 2010 08:24:47 -0400
Subject: [PATCH] Fixes a bug that prevented matching deleted pages when using
 the page() PageSpec.

---
 IkiWiki.pm                                        | 15 +++++++++------
 debian/changelog                                  |  2 ++
 ...34___deletion_does_not_refresh_front_page.mdwn |  2 +-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/IkiWiki.pm b/IkiWiki.pm
index e08d02922..df8abe2c2 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -2439,13 +2439,16 @@ sub match_internal ($$;@) {
 sub match_page ($$;@) {
 	my $page=shift;
 	my $match=match_glob($page, shift, @_);
-	if ($match && ! (exists $IkiWiki::pagesources{$page}
-	    && defined IkiWiki::pagetype($IkiWiki::pagesources{$page}))) {
-		return IkiWiki::FailReason->new("$page is not a page");
-	}
-	else {
-		return $match;
+	if ($match) {
+		my $source=exists $IkiWiki::pagesources{$page} ?
+			$IkiWiki::pagesources{$page} :
+			$IkiWiki::delpagesources{$page};
+		my $type=defined $source ? IkiWiki::pagetype($source) : undef;
+		if (! defined $type) {	
+			return IkiWiki::FailReason->new("$page is not a page");
+		}
 	}
+	return $match;
 }
 
 sub match_link ($$;@) {
diff --git a/debian/changelog b/debian/changelog
index 25123cecc..5c0064845 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ ikiwiki (3.20100723) UNRELEASED; urgency=low
     have been disabled.
   * Use Digest::SHA built into perl rather than external Digest::SHA1
     to simplify dependencies. Closes: #591040
+  * Fixes a bug that prevented matching deleted pages when using the page()
+    PageSpec.
 
  -- Joey Hess <joeyh@debian.org>  Fri, 23 Jul 2010 14:00:32 -0400
 
diff --git a/doc/bugs/__34__First_post__34___deletion_does_not_refresh_front_page.mdwn b/doc/bugs/__34__First_post__34___deletion_does_not_refresh_front_page.mdwn
index 78009da75..2367335a7 100644
--- a/doc/bugs/__34__First_post__34___deletion_does_not_refresh_front_page.mdwn
+++ b/doc/bugs/__34__First_post__34___deletion_does_not_refresh_front_page.mdwn
@@ -3,4 +3,4 @@ Deleting that post removed it, but the front page did not get the re-generated,
 --[[liw]]
 
 > This is a bug involving the `page()` pagespec. Deleted
-> pages matching this pagespec are not noticed. --[[Joey]] 
+> pages matching this pagespec are not noticed. --[[Joey]] [[done]]
-- 
2.39.5