only_committed_changes could fail in a git repository merged with git merge -s ours.
authorJoey Hess <joey@kitenet.net>
Sat, 5 Apr 2014 23:09:05 +0000 (19:09 -0400)
committerJoey Hess <joey@kitenet.net>
Sat, 5 Apr 2014 23:09:05 +0000 (19:09 -0400)
IkiWiki/Plugin/git.pm
debian/changelog

index 4b0e5a86d065fba816d58564dd0593209c9d3680..75b89e476bbb4bf1da262385a8e390994489f0e9 100644 (file)
@@ -467,6 +467,11 @@ sub git_commit_info ($;$) {
 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',
@@ -482,12 +487,16 @@ sub rcs_find_changes ($) {
                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 {
-                               delete $deleted{$file};
-                               $changed{$file}=1;
+                               if (-e "$config{srcdir}/$file") {
+                                       delete $deleted{$file};
+                                       $changed{$file}=1;
+                               }
                        }
                }
        }
index d9134259537e37898f412de405c729929dffaa0a..0c36baf606f977e684d64d05e4321980fe1d98bf 100644 (file)
@@ -1,3 +1,10 @@
+ikiwiki (3.20140228) UNRELEASED; urgency=medium
+
+  * only_committed_changes could fail in a git repository merged
+    with git merge -s ours.
+
+ -- Joey Hess <joeyh@debian.org>  Sat, 05 Apr 2014 19:08:22 -0400
+
 ikiwiki (3.20140227) unstable; urgency=medium
 
   * Added useragent config setting. Closes: #737121