diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 28c2f7496..d13f06834 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -357,6 +357,11 @@ module Redmine diff << line end end + # "git show" of Git 2.55.0 prints the commit header even when the + # given path is not modified by the commit. Discard such output so + # that an empty diff is returned as with the other versions. + return [] if !path.empty? && diff.none? {|line| line.start_with?('diff --')} + diff rescue ScmCommandAborted nil