X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9fd09149a36e13addcb822e41d0309c64a004764..087a9d93c29e4d6bb03ceb4e555470382ac022d9:/IkiWiki/Plugin/cvs.pm?ds=inline diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm index dafaf13f5..0a6cbfaf6 100644 --- a/IkiWiki/Plugin/cvs.pm +++ b/IkiWiki/Plugin/cvs.pm @@ -208,9 +208,6 @@ 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); @@ -219,15 +216,8 @@ sub rcs_add ($) { while ($file = pop @files_to_add) { 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"); - } + cvs_runcvs('add', cvs_keyword_subst_args($file)) || + warn("cvs add $file failed\n"); } else { # directory @@ -489,6 +479,24 @@ sub cvs_is_controlling { return (-d "$dir/CVS") ? 1 : 0; } +sub cvs_keyword_subst_args ($) { + my $file = shift; + + local $CWD = $config{srcdir}; + + eval q{use File::MimeInfo}; + error($@) if $@; + my $filemime = File::MimeInfo::default($file); + # if (-T $file) { + + if (defined($filemime) && $filemime eq 'text/plain') { + return ($file); + } + else { + return ('-kb', $file); + } +} + sub cvs_runcvs(@) { my @cmd = @_; unshift @cmd, 'cvs', '-Q';