diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-05 19:09:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-05 19:09:05 -0400 |
commit | 59cfb9b6d0f5f60516d17c79365318711a92fb04 (patch) | |
tree | 388f7376e07140dd88a3dcc0aaa2ac909776e5d1 /IkiWiki/Plugin | |
parent | 9989114c1f662ddbdf3970be7324c97d0f59c9e5 (diff) | |
download | ikiwiki-59cfb9b6d0f5f60516d17c79365318711a92fb04.tar ikiwiki-59cfb9b6d0f5f60516d17c79365318711a92fb04.tar.gz |
only_committed_changes could fail in a git repository merged with git merge -s ours.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 4b0e5a86d..75b89e476 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -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; + } } } } |