git_diff 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/git_diff/file.rb +4 -4
- data/lib/git_diff/version.rb +1 -1
- data/test/git_diff_test.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ca650390bcd8c35eb34899b6210864326ed34470f4e532c5e2dffffc51155c4b
|
4
|
+
data.tar.gz: 2a2ff0c950222e444cccd990dacba5e032993d6ae66f9fb5df604fcdbcd64b9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d083304b87f4288f733ba28c9a294784d2a4797ab6f046b3b5260ab4c0031797badb16e00c205ca53d86836f47c62c46300cb217514bd39450a20d9aa71ab5e5
|
7
|
+
data.tar.gz: 85ee7dbc373a614f74ddad8ab776e761dc6d1b329c26e10fba5d426dece21dc9262f68f30821d431d53dcb4e2698ce1979f63aa5a00c9935bf527c9015ac71cb
|
data/lib/git_diff/file.rb
CHANGED
@@ -72,11 +72,11 @@ module GitDiff
|
|
72
72
|
else
|
73
73
|
@b_mode = mode_info.captures[1]
|
74
74
|
end
|
75
|
-
when
|
76
|
-
if
|
77
|
-
@a_path =
|
75
|
+
when copy_rename_info = /^(copy|rename) (from|to) (.*)$/.match(string)
|
76
|
+
if copy_rename_info.captures[1] == "from"
|
77
|
+
@a_path = copy_rename_info.captures[2]
|
78
78
|
else
|
79
|
-
@b_path =
|
79
|
+
@b_path = copy_rename_info.captures[2]
|
80
80
|
end
|
81
81
|
when binary_info = /^Binary files (?:\/dev\/null|a\/(.*)) and (?:\/dev\/null|b\/(.*)) differ$/.match(string)
|
82
82
|
@binary = true
|
data/lib/git_diff/version.rb
CHANGED
data/test/git_diff_test.rb
CHANGED
@@ -180,4 +180,22 @@ rename to lib/path2/my_file2.rb'
|
|
180
180
|
assert_equal "lib/path1/my_file.rb", file.a_path
|
181
181
|
assert_equal "lib/path2/my_file2.rb", file.b_path
|
182
182
|
end
|
183
|
+
|
184
|
+
def test_copy_diff
|
185
|
+
diff = GitDiff.from_string 'diff --git a/lib/path1/my_file.rb b/lib/path2/my_file2.rb
|
186
|
+
similarity index 100%
|
187
|
+
copy from lib/path1/my_file.rb
|
188
|
+
copy to lib/path2/my_file2.rb'
|
189
|
+
|
190
|
+
refute_nil diff
|
191
|
+
assert_instance_of GitDiff::Diff, diff
|
192
|
+
|
193
|
+
assert_equal 1, diff.files.count
|
194
|
+
file = diff.files[0]
|
195
|
+
|
196
|
+
assert_equal 0, file.hunks.count
|
197
|
+
|
198
|
+
assert_equal "lib/path1/my_file.rb", file.a_path
|
199
|
+
assert_equal "lib/path2/my_file2.rb", file.b_path
|
200
|
+
end
|
183
201
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Olson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.6.
|
122
|
+
rubygems_version: 2.7.6.2
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: A Ruby library for parsing git diffs.
|