aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-15 00:06:20 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-15 00:06:20 +0000
commitc8f7b9480e6e2ef44633e640fcca57c4658de3f3 (patch)
tree9ae2847525bcf32b844413cb3ed22a5814558e03 /IkiWiki
parent2d4b27330e41706af493f49ff8d215357a2a4f35 (diff)
downloadikiwiki-c8f7b9480e6e2ef44633e640fcca57c4658de3f3.tar
ikiwiki-c8f7b9480e6e2ef44633e640fcca57c4658de3f3.tar.gz
proper fix for adding file, based on jkoenig's patch
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm13
-rw-r--r--IkiWiki/Rcs/Stub.pm2
2 files changed, 9 insertions, 6 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 31b1f748a..07319ad22 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -497,9 +497,11 @@ sub cgi_editpage ($$) { #{{{
else {
# save page
check_canedit($page, $q, $session);
- if (! -e "$config{srcdir}/$file" &&
- ! -e "$config{underlaydir}/$file" &&
- $form->field("do") ne "create") {
+
+ my $exists=-e "$config{srcdir}/$file";
+
+ if ($form->field("do") ne "create" &&
+ ! $exists && ! -e "$config{underlaydir}/$file") {
$form->tmpl_param("page_gone", 1);
$form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0);
@@ -510,8 +512,7 @@ sub cgi_editpage ($$) { #{{{
print misctemplate($form->title, $form->render(submit => \@buttons));
return;
}
- elsif (-e "$config{srcdir}/$file" &&
- $form->field("do") eq "create") {
+ elsif ($form->field("do") eq "create" && $exists) {
$form->tmpl_param("creation_conflict", 1);
$form->field(name => "do", value => "edit", force => 1);
$form->tmpl_param("page_select", 0);
@@ -558,7 +559,7 @@ sub cgi_editpage ($$) { #{{{
$message=$form->field('comments');
}
- if (! -e "$config{srcdir}/$file") {
+ if (! $exists) {
rcs_add($file);
}
diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm
index 03757758a..19ecfa88d 100644
--- a/IkiWiki/Rcs/Stub.pm
+++ b/IkiWiki/Rcs/Stub.pm
@@ -29,6 +29,8 @@ sub rcs_commit ($$$;$$) {
sub rcs_add ($) {
# Add a file. The filename is relative to the root of the srcdir.
+ # Note that this should not check the new file in, it should only
+ # prepare for it to be checked in when rcs_commit is called.
}
sub rcs_recentchanges ($) {