We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 50d80b6 + c7b31d1 commit 45b085aCopy full SHA for 45b085a
lib/git/diff.rb
@@ -6,8 +6,8 @@ class Diff
6
7
def initialize(base, from = nil, to = nil)
8
@base = base
9
- @from = from.to_s
10
- @to = to.to_s
+ @from = from && from.to_s
+ @to = to && to.to_s
11
12
@path = nil
13
@full_diff = nil
tests/units/test_diff.rb
@@ -14,6 +14,14 @@ def setup
14
# assert(1, d.size)
15
#end
16
17
+ def test_diff_current_vs_head
18
+ #test git diff without specifying source/destination commits
19
+ update_file(File.join(@wdir,"example.txt"),"FRANCO")
20
+ d = @git.diff
21
+ patch = d.patch
22
+ assert(patch.match(/\+FRANCO/))
23
+ end
24
+
25
def test_diff_tags
26
d = @git.diff('gitsearch1', 'v2.5')
27
assert_equal(3, d.size)
0 commit comments