aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/cvs.pm
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz@magnetic-babysitter.(none)>2009-08-30 00:17:42 -0400
committerAmitai Schlair <schmonz@magnetic-babysitter.(none)>2009-08-30 00:17:42 -0400
commitb493f9b6d8e2131dd2338da05d98fded592d0943 (patch)
tree03fed6b9fcf03e717b68bf57396a775e2de01393 /IkiWiki/Plugin/cvs.pm
parent992d0aac09a3e3e81d7ad999910a4a026984f804 (diff)
downloadikiwiki-b493f9b6d8e2131dd2338da05d98fded592d0943.tar
ikiwiki-b493f9b6d8e2131dd2338da05d98fded592d0943.tar.gz
Knock off a to-do item: "If the argument to cvs add smells like a
binary file, cvs add -kb it (for attachment support)."
Diffstat (limited to 'IkiWiki/Plugin/cvs.pm')
-rw-r--r--IkiWiki/Plugin/cvs.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm
index 20b9f793a..ccd9527cd 100644
--- a/IkiWiki/Plugin/cvs.pm
+++ b/IkiWiki/Plugin/cvs.pm
@@ -219,14 +219,25 @@ sub rcs_add ($) {
my $parent=IkiWiki::dirname($file);
my @files_to_add = ($file);
+ eval q{use File::MimeInfo};
+ error($@) if $@;
+
until ((length($parent) == 0) || cvs_is_controlling("$config{srcdir}/$parent")){
push @files_to_add, $parent;
$parent = IkiWiki::dirname($parent);
}
while ($file = pop @files_to_add) {
- cvs_runcvs(['add', $file]) ||
- warn("cvs add $file failed\n");
+ 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");
+ } else {
+ # directory or regular file
+ cvs_runcvs(['add', $file]) ||
+ warn("cvs add $file failed\n");
+ }
}
}