git_diff 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 672b777fb8790a44f2e6b01556af296002a51951
4
- data.tar.gz: 9b3070e4bdc69fbae0f2d037bc6523f899ff2f41
2
+ SHA256:
3
+ metadata.gz: ca650390bcd8c35eb34899b6210864326ed34470f4e532c5e2dffffc51155c4b
4
+ data.tar.gz: 2a2ff0c950222e444cccd990dacba5e032993d6ae66f9fb5df604fcdbcd64b9d
5
5
  SHA512:
6
- metadata.gz: 72bb72337221cee7f29073f6d4d4902858558413b86792cea4ed09cedf20db2ed51cd859ad32a0819020b3640000727a43a502d1dfeb0c46156d0488968c8d5c
7
- data.tar.gz: 43b3bb333a718a2c56f5ddb671ef6b10daaf2dd7c314689b5b8d7d34e3e613ec0a08a80eb2c033df5638d6d5a602cf8c1c38a202f6626e5eaef0db6a04cd7cae
6
+ metadata.gz: d083304b87f4288f733ba28c9a294784d2a4797ab6f046b3b5260ab4c0031797badb16e00c205ca53d86836f47c62c46300cb217514bd39450a20d9aa71ab5e5
7
+ data.tar.gz: 85ee7dbc373a614f74ddad8ab776e761dc6d1b329c26e10fba5d426dece21dc9262f68f30821d431d53dcb4e2698ce1979f63aa5a00c9935bf527c9015ac71cb
@@ -72,11 +72,11 @@ module GitDiff
72
72
  else
73
73
  @b_mode = mode_info.captures[1]
74
74
  end
75
- when rename_info = /^rename (from|to) (.*)$/.match(string)
76
- if rename_info.captures[0] == "from"
77
- @a_path = rename_info.captures[1]
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 = rename_info.captures[1]
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
@@ -1,3 +1,3 @@
1
1
  module GitDiff
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -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.1
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: 2018-06-30 00:00:00.000000000 Z
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.14
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.