diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-10-24 13:44:03 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-10-24 13:44:03 -0400 |
commit | 1a883b3c504a543c8f4a5b5bb9687e7770f28a4f (patch) | |
tree | 20b90e8dd2e77476b2d26ace831ba71290a7c1c4 /IkiWiki/Plugin | |
parent | dfef51e10ed46419ce361411a0fd27966d84e21e (diff) |
include temp file for attachment change too
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 3a8476e7d..84df56181 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -619,7 +619,7 @@ sub rcs_receive () { #{{{ # Avoid chdir when running git here, because the changes # are in the master git repo, not the srcdir repo. - # The pre-receive hook already puts us in the right place. + # The pre-recieve hook already puts us in the right place. $no_chdir=1; my @changes=git_commit_info($oldrev."..".$newrev); $no_chdir=0; @@ -643,15 +643,6 @@ sub rcs_receive () { #{{{ elsif ($detail->{'status'} =~ /^[AM]+\d*$/) { $action="add"; $mode=$detail->{'mode_to'}; - if (! pagetype($file)) { - eval q{use File::Temp}; - die $@ if $@; - my $fh; - ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); - if (system("git show ".$detail->{sha1_to}." > '$path'") != 0) { - error("failed writing temp file"); - } - } } elsif ($detail->{'status'} =~ /^[DAM]+\d*/) { $action="remove"; @@ -670,6 +661,18 @@ sub rcs_receive () { #{{{ error gettext("you are not allowed to change file modes"); } } + + # extract attachment to temp file + if (($action eq 'add' || $action eq 'change') && + ! pagetype($file)) { + eval q{use File::Temp}; + die $@ if $@; + my $fh; + ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); + if (system("git show ".$detail->{sha1_to}." > '$path'") != 0) { + error("failed writing temp file"); + } + } push @rets, { file => $file, |