]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/git.pm
sohrten url in subject
[git.ikiwiki.info.git] / IkiWiki / Plugin / git.pm
index 9e67a36ee79465303b7983b9a4e44b6f7388b704..4d48388a04fdc2e9c3d6ea7c71b40d3ba3ccd88c 100644 (file)
@@ -467,6 +467,11 @@ sub git_commit_info ($;$) {
 sub rcs_find_changes ($) {
        my $oldrev=shift;
 
 sub rcs_find_changes ($) {
        my $oldrev=shift;
 
+       # Note that git log will sometimes show files being added that
+       # don't exist. Particularly, git merge -s ours can result in a
+       # merge commit where some files were not really added.
+       # This is why the code below verifies that the files really
+       # exist.
        my @raw_lines = run_or_die('git', 'log',
                '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
                '--no-renames', , '--reverse',
        my @raw_lines = run_or_die('git', 'log',
                '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
                '--no-renames', , '--reverse',
@@ -482,12 +487,16 @@ sub rcs_find_changes ($) {
                foreach my $i (@{$ci->{details}}) {
                        my $file=$i->{file};
                        if ($i->{sha1_to} eq $nullsha) {
                foreach my $i (@{$ci->{details}}) {
                        my $file=$i->{file};
                        if ($i->{sha1_to} eq $nullsha) {
-                               delete $changed{$file};
-                               $deleted{$file}=1;
+                               if (! -e "$config{srcdir}/$file") {
+                                       delete $changed{$file};
+                                       $deleted{$file}=1;
+                               }
                        }
                        else {
                        }
                        else {
-                               delete $deleted{$file};
-                               $changed{$file}=1;
+                               if (-e "$config{srcdir}/$file") {
+                                       delete $deleted{$file};
+                                       $changed{$file}=1;
+                               }
                        }
                }
        }
                        }
                }
        }
@@ -570,7 +579,7 @@ sub rcs_commit_helper (@) {
                        $u=$params{session}->remote_addr();
                }
                if (defined $u) {
                        $u=$params{session}->remote_addr();
                }
                if (defined $u) {
-                       $u=encode_utf8($u);
+                       $u=encode_utf8(IkiWiki::cloak($u));
                        $ENV{GIT_AUTHOR_NAME}=$u;
                }
                if (defined $params{session}->param("nickname")) {
                        $ENV{GIT_AUTHOR_NAME}=$u;
                }
                if (defined $params{session}->param("nickname")) {
@@ -609,7 +618,7 @@ sub rcs_commit_helper (@) {
        # So we should ignore its exit status (hence run_or_non).
        if (run_or_non('git', 'commit', '-m', $params{message}, '-q', @opts)) {
                if (length $config{gitorigin_branch}) {
        # So we should ignore its exit status (hence run_or_non).
        if (run_or_non('git', 'commit', '-m', $params{message}, '-q', @opts)) {
                if (length $config{gitorigin_branch}) {
-                       run_or_cry('git', 'push', $config{gitorigin_branch});
+                       run_or_cry('git', 'push', $config{gitorigin_branch}, $config{gitmaster_branch});
                }
        }
        
                }
        }