From d472e293cd1c8b15e79b7075be1068bba3ec4af1 Mon Sep 17 00:00:00 2001
From: joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Date: Wed, 7 Feb 2007 00:45:00 +0000
Subject: [PATCH 1/1] fixes and more tests

---
 IkiWiki.pm             |  2 +-
 doc/plugins/write.mdwn |  6 +++---
 po/ikiwiki.pot         |  2 +-
 t/pagespec_match.t     | 11 ++++++-----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/IkiWiki.pm b/IkiWiki.pm
index a547c57ef..32ca0449f 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -881,7 +881,7 @@ sub match_glob ($$$) { #{{{
 	if ($glob =~ m!^\./!) {
 		$from=~s!/?[^/]+$!!;
 		$glob=~s!^\./!!;
-		$glob="$from/$glob";
+		$glob="$from/$glob" if length $from;
 	}
 
 	# turn glob into safe regexp
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index d822408c2..1aaaf1d1e 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -314,9 +314,9 @@ Makes the specified page depend on the specified [[PageSpec]].
 
 #### `pagespec_match($$;$)`
 
-Passed a page name, a [[PageSpec]], and the location the glob should be
-matched against, returns true if the [[PageSpec]] matches the page. (If the
-third parameter is not passed, relative PageSpecs will match relative to
+Passed a page name, a [[PageSpec]], and the location the [[PageSpec]] should
+be matched against, returns true if the [[PageSpec]] matches the page. (If
+the third parameter is not passed, relative PageSpecs will match relative to
 the top of the wiki.)
 
 #### `bestlink($$)`
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index 7ec22a689..6fd3644e8 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-02-06 15:59-0500\n"
+"POT-Creation-Date: 2007-02-06 19:43-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index 1b8143577..bd517f58b 100755
--- a/t/pagespec_match.t
+++ b/t/pagespec_match.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 40;
+use Test::More tests => 41;
 
 BEGIN { use_ok("IkiWiki"); }
 
@@ -18,10 +18,11 @@ ok(! pagespec_match("foo", "* and !foo", ""));
 ok(! pagespec_match("foo", "foo and !foo", ""));
 ok(! pagespec_match("foo.png", "* and !*.*", ""));
 ok(pagespec_match("foo", "(bar or ((meep and foo) or (baz or foo) or beep))", ""));
-ok(! pagespec_match("foo/bar", "./*", "foo"), "relative fail");
-ok(! pagespec_match("a/foo", "./*", "a/b"), "relative");
-ok(! pagespec_match("a/b/foo", "./*", "a/b"), "relative fail");
-ok(! pagespec_match("foo", "./*", "a"), "relative toplevel");
+ok(! pagespec_match("a/foo", "foo", "a/b"), "nonrelative fail");
+ok(! pagespec_match("foo", "./*", "a/b"), "relative fail");
+ok(pagespec_match("a/foo", "./*", "a/b"), "relative");
+ok(pagespec_match("a/b/foo", "./*", "a/b"), "relative 2");
+ok(pagespec_match("foo", "./*", "a"), "relative toplevel");
 ok(pagespec_match("foo/bar", "*", "baz"), "absolute");
 
 $links{foo}=[qw{bar baz}];
-- 
2.39.5