]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Fix uninitialized value when editing a page being vivified from the
authorAmitai Schlair <schmonz@magnetic-babysitter.(none)>
Sun, 30 Aug 2009 17:49:38 +0000 (13:49 -0400)
committerAmitai Schlair <schmonz@magnetic-babysitter.(none)>
Sun, 30 Aug 2009 17:49:38 +0000 (13:49 -0400)
basewiki. Makes the filetype-testing logic more explicit anyway.

IkiWiki/Plugin/cvs.pm

index 66e9463be562a515b1c7665adb97e6bf6245d75b..fa4c4da8e94ad250e0615786fe57b508fb2bbfcd 100644 (file)
@@ -226,13 +226,18 @@ sub rcs_add ($) {
        }
 
        while ($file = pop @files_to_add) {
        }
 
        while ($file = pop @files_to_add) {
-               if ((@files_to_add == 0) &&
-                       (File::MimeInfo::default $file ne 'text/plain')) {
-                       # it's a binary file, add specially
-                       cvs_runcvs(['add', '-kb', $file]) ||
-                               warn("cvs add $file failed\n");
+               if (@files_to_add == 0) {
+                       # file
+                       my $filemime = File::MimeInfo::default($file);
+                       if (defined($filemime) && $filemime eq 'text/plain') {
+                               cvs_runcvs(['add', $file]) ||
+                                       warn("cvs add $file failed\n");
+                       } else {
+                               cvs_runcvs(['add', '-kb', $file]) ||
+                                       warn("cvs add binary $file failed\n");
+                       }
                } else {
                } else {
-                       # directory or regular file
+                       # directory
                        cvs_runcvs(['add', $file]) ||
                                warn("cvs add $file failed\n");
                }
                        cvs_runcvs(['add', $file]) ||
                                warn("cvs add $file failed\n");
                }