kintsugi 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cad34bb224a6760f052ff90ac433095e7fb071e7b59ca9018719e3c6a8f5c96
4
- data.tar.gz: a0b9675697896041b08d60186804e3c112e51c0dd61d66d26ce9f9310c626f4e
3
+ metadata.gz: f9f20babc40a6ddf7228d2455e23d165a2d696929f5507fc8de0a9878353280f
4
+ data.tar.gz: 8ffd34dd7f504193c0a35d1347fa92c6edde6976602b5e62658ba9a637b6bc81
5
5
  SHA512:
6
- metadata.gz: 359e1799a2f313daf547645342677eca83f58a76dc857d2f72b6f97b06318455385cec7b0145344c380ec659376ff3228add2f6c91499f1bef1cd20d63beae11
7
- data.tar.gz: 04c9e862353bef092c14464de1e781c3d2168ad958fb8c5d08ed53f74e4090921023f674e6759eff997fbe2994af9514a0d546de4a8d652b19e5a37b32ce3970
6
+ metadata.gz: d8477aaafe2a4afed13fce37f5a5963b79ab2d3e26e4816abf4cd7b082b5a9a09cd189260713bbd5f82eaf9f8f8227b92bcd5dc79ad90acf1c0cc5d4ee9e8971
7
+ data.tar.gz: d63cf3848b727c894a9c294b75023c46e12b5672f03144bb7068477edc7765372b2e5e586c03bc69560f71a8145b7c2b3074a5246a4726a965b98a87050a59cb
@@ -103,6 +103,12 @@ module Kintsugi
103
103
  group_type = Module.const_get("Xcodeproj::Project::#{change["isa"]}")
104
104
  containing_group = path.empty? ? project.main_group : project[path]
105
105
 
106
+ if containing_group.nil?
107
+ raise MergeError, "Trying to add or move a group with change #{change} to a group that " \
108
+ "no longer exists with path '#{path}'. This is considered a conflict that should be " \
109
+ "resolved manually."
110
+ end
111
+
106
112
  next if !Settings.allow_duplicates &&
107
113
  !find_group_in_group(containing_group, group_type, change).nil?
108
114
 
@@ -144,6 +150,12 @@ module Kintsugi
144
150
  containing_group = path.empty? ? project.main_group : project[path]
145
151
  change_key = file_reference_key(change)
146
152
 
153
+ if containing_group.nil?
154
+ raise MergeError, "Trying to add or move a file with change #{change} to a group that " \
155
+ "no longer exists with path '#{path}'. This is considered a conflict that should be " \
156
+ "resolved manually."
157
+ end
158
+
147
159
  if (removal_keys_to_references[change_key] || []).empty?
148
160
  apply_file_addition(containing_group, change, "rootObject/mainGroup/#{path}")
149
161
  elsif addition_keys_to_paths[change_key].length == 1 &&
@@ -3,6 +3,6 @@
3
3
  module Kintsugi
4
4
  # This module holds the Kintsugi version information.
5
5
  module Version
6
- STRING = "0.6.2"
6
+ STRING = "0.6.3"
7
7
  end
8
8
  end
@@ -159,6 +159,59 @@ describe Kintsugi, :apply_change_to_project do
159
159
  expect(base_project).to be_equivalent_to_project(theirs_project)
160
160
  end
161
161
 
162
+ it "raises if trying to move file to another group that no longer exists" do
163
+ base_project.main_group.find_subpath("new_group", true)
164
+ base_project.save
165
+
166
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
167
+ new_group = theirs_project.main_group.find_subpath("new_group")
168
+ file_reference = theirs_project.main_group.find_file_by_path(filepath)
169
+ file_reference.move(new_group)
170
+
171
+ changes_to_apply = get_diff(theirs_project, base_project)
172
+
173
+ base_project.main_group.find_subpath("new_group").remove_from_project
174
+
175
+ expect {
176
+ described_class.apply_change_to_project(base_project, changes_to_apply)
177
+ }.to raise_error(Kintsugi::MergeError)
178
+ end
179
+
180
+ it "raises if trying to add file to a group that no longer exists" do
181
+ base_project.main_group.find_subpath("new_group", true)
182
+ base_project.save
183
+
184
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
185
+ theirs_project.main_group.find_subpath("new_group").new_reference("foo")
186
+
187
+ changes_to_apply = get_diff(theirs_project, base_project)
188
+
189
+ base_project.main_group.find_subpath("new_group").remove_from_project
190
+
191
+ expect {
192
+ described_class.apply_change_to_project(base_project, changes_to_apply)
193
+ }.to raise_error(Kintsugi::MergeError)
194
+ end
195
+
196
+ it "does nothing if trying to remove a file from a group that no longer exists" do
197
+ base_project.main_group.find_subpath("new_group", true).new_reference("foo")
198
+ base_project.save
199
+
200
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
201
+ theirs_project.main_group.find_subpath("new_group/foo").remove_from_project
202
+
203
+ changes_to_apply = get_diff(theirs_project, base_project)
204
+
205
+ base_project.main_group.find_subpath("new_group").remove_from_project
206
+
207
+ base_project.save
208
+ expected_project = create_copy_of_project(base_project.path, "expected")
209
+
210
+ described_class.apply_change_to_project(base_project, changes_to_apply)
211
+
212
+ expect(base_project).to be_equivalent_to_project(expected_project)
213
+ end
214
+
162
215
  it "raises when a file is split into two" do
163
216
  base_project.main_group.find_subpath("new_group", true)
164
217
  base_project.main_group.find_subpath("new_group2", true)
@@ -219,6 +272,39 @@ describe Kintsugi, :apply_change_to_project do
219
272
  expect(base_project).to be_equivalent_to_project(theirs_project)
220
273
  end
221
274
 
275
+ it "raises when trying to add a group to a group that no longer exists" do
276
+ base_project.main_group.find_subpath("new_group", true)
277
+ base_project.save
278
+
279
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
280
+ theirs_project["new_group"].find_subpath("sub_group", true)
281
+
282
+ changes_to_apply = get_diff(theirs_project, base_project)
283
+
284
+ base_project.main_group.find_subpath("new_group").remove_from_project
285
+
286
+ expect {
287
+ described_class.apply_change_to_project(base_project, changes_to_apply)
288
+ }.to raise_error(Kintsugi::MergeError)
289
+ end
290
+
291
+ it "raises when trying to move a group to a group that no longer exists" do
292
+ base_project.main_group.find_subpath("new_group", true)
293
+ base_project.main_group.find_subpath("other_group", true)
294
+ base_project.save
295
+
296
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
297
+ theirs_project["other_group"].move(theirs_project["new_group"])
298
+
299
+ changes_to_apply = get_diff(theirs_project, base_project)
300
+
301
+ base_project.main_group.find_subpath("new_group").remove_from_project
302
+
303
+ expect {
304
+ described_class.apply_change_to_project(base_project, changes_to_apply)
305
+ }.to raise_error(Kintsugi::MergeError)
306
+ end
307
+
222
308
  it "moves a group with a group in it" do
223
309
  new_group = base_project.main_group.find_subpath("new_group", true)
224
310
  new_group.find_subpath("sub_group", true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kintsugi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Yohay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.3.22
171
+ rubygems_version: 3.3.26
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: pbxproj files git conflicts solver