Skip to content
Browse files

Fix a bug where added or removed files would not displayed as "/dev/n…

…ull" in the diff output
  • Loading branch information...
1 parent fcf112d commit 619fa94a36c6939c62aa0a523dc04045d631f0ea Marius Mathiesen committed Aug 16, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 vendor/grit/lib/grit/git-ruby/repository.rb
View
9 vendor/grit/lib/grit/git-ruby/repository.rb
@@ -407,8 +407,13 @@ def diff(commit1, commit2, options = {})
header << "\n" + 'index ' + sha1[0,7] + '..' + sha2[0,7]
header << ' 100644' if diff_arr[3] # hard coding this because i don't think we use it
end
- header << "\n--- " + 'a/' + diff_arr[0].gsub('./', '')
- header << "\n+++ " + 'b/' + diff_arr[0].gsub('./', '')
+
+ a_path = "a/#{diff_arr[0].gsub('./', '')}"
+ b_path = "b/#{diff_arr[0].gsub('./', '')}"
+
+ header << "\n--- " + (diff_arr[2] ? a_path : '/dev/null')
+ header << "\n+++ " + (diff_arr[3] ? b_path : '/dev/null')
+
header += "\n"
oldhunk = hunk = nil

0 comments on commit 619fa94

Please sign in to comment.
Something went wrong with that request. Please try again.