Class: Grit::Commit
- Inherits:
-
Object
- Object
- Grit::Commit
- Defined in:
- lib/gitgo/patches/grit.rb
Class Method Summary collapse
-
.diff(repo, a, b = nil, paths = []) ⇒ Object
This patch allows file add/remove to be detected in diffs.
Class Method Details
.diff(repo, a, b = nil, paths = []) ⇒ Object
This patch allows file add/remove to be detected in diffs. For some reason with the original version (commented out) the diff is missing certain crucial lines in the output:
diff --git a/alpha.txt b/alpha.txt
index 0000000000000000000000000000000000000000..15db91c38a4cd47235961faa407304bf47ea5d15 100644
--- a/alpha.txt
+++ b/alpha.txt
@@ -1 +1,2 @@
+Contents of file alpha.
vs
diff --git a/alpha.txt b/alpha.txt
new file mode 100644
index 0000000000000000000000000000000000000000..15db91c38a4cd47235961faa407304bf47ea5d15
--- /dev/null
+++ b/alpha.txt
@@ -0,0 +1 @@
+Contents of file alpha.
Perhaps the original drops into the pure-ruby version of git?
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gitgo/patches/grit.rb', line 33 def self.diff(repo, a, b = nil, paths = []) if b.is_a?(Array) paths = b b = nil end paths.unshift("--") unless paths.empty? paths.unshift(b) unless b.nil? paths.unshift(a) # text = repo.git.diff({:full_index => true}, *paths) text = repo.git.run('', :diff, '', {:full_index => true}, paths) Grit::Diff.list_from_string(repo, text) end |