kintsugi 0.6.1 → 0.6.2

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: b1bb4d750b89e3f7648a84bb65fefe78abcba67a04f4c92bde7a636a3af0e5b0
4
- data.tar.gz: eec2d98b161b7079af42c8fbfb1da27960d4557bb1a1fcda1473c82873fc6c62
3
+ metadata.gz: 3cad34bb224a6760f052ff90ac433095e7fb071e7b59ca9018719e3c6a8f5c96
4
+ data.tar.gz: a0b9675697896041b08d60186804e3c112e51c0dd61d66d26ce9f9310c626f4e
5
5
  SHA512:
6
- metadata.gz: '09aaa8afe8d45faa843182e86d883e60996782967ce3d6f03fac9310a5197659c4c3f218293d71752d3feabd3aa44b8f9f36ddeae6a78ec1da2317ed48fcb1be'
7
- data.tar.gz: 9eb2ebc3653c1d6ecf3467b9d0a125902313c3221ef53599e5a5b343bc6eda346f31306651a8ec8014086f695abd68b9283983b6f10136c1e854e1975d66eae7
6
+ metadata.gz: 359e1799a2f313daf547645342677eca83f58a76dc857d2f72b6f97b06318455385cec7b0145344c380ec659376ff3228add2f6c91499f1bef1cd20d63beae11
7
+ data.tar.gz: 04c9e862353bef092c14464de1e781c3d2168ad958fb8c5d08ed53f74e4090921023f674e6759eff997fbe2994af9514a0d546de4a8d652b19e5a37b32ce3970
@@ -195,12 +195,17 @@ module Kintsugi
195
195
  end
196
196
 
197
197
  def apply_group_removals(project, removals)
198
- removals.each do |change, path|
198
+ removals.sort_by(&:last).reverse.each do |change, path|
199
199
  next unless %w[PBXGroup PBXVariantGroup].include?(change["isa"])
200
200
 
201
201
  group_path = join_path(path, change["displayName"])
202
202
 
203
- remove_component(project[group_path], change)
203
+ # by now we've deleted all of this group's children in the project, so we need to adapt the
204
+ # change to the expected current state of the group, that is, without any children.
205
+ change_without_children = change.dup
206
+ change_without_children["children"] = []
207
+
208
+ remove_component(project[group_path], change_without_children)
204
209
  end
205
210
  end
206
211
 
@@ -687,7 +692,7 @@ module Kintsugi
687
692
  end
688
693
 
689
694
  existing_build_file = build_phase.files.find do |build_file|
690
- build_file.file_ref.path == change["fileRef"]["path"]
695
+ build_file.file_ref && build_file.file_ref.path == change["fileRef"]["path"]
691
696
  end
692
697
  return if !Settings.allow_duplicates && !existing_build_file.nil?
693
698
 
@@ -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.1"
6
+ STRING = "0.6.2"
7
7
  end
8
8
  end
@@ -203,6 +203,55 @@ describe Kintsugi, :apply_change_to_project do
203
203
  expect(base_project).to be_equivalent_to_project(theirs_project)
204
204
  end
205
205
 
206
+ it "moves a group with files in it" do
207
+ new_group = base_project.main_group.find_subpath("new_group", true)
208
+ new_group.new_reference("new_file")
209
+ base_project.save
210
+
211
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
212
+ new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
213
+ theirs_project["new_group"].move(new_group2)
214
+
215
+ changes_to_apply = get_diff(theirs_project, base_project)
216
+
217
+ described_class.apply_change_to_project(base_project, changes_to_apply)
218
+
219
+ expect(base_project).to be_equivalent_to_project(theirs_project)
220
+ end
221
+
222
+ it "moves a group with a group in it" do
223
+ new_group = base_project.main_group.find_subpath("new_group", true)
224
+ new_group.find_subpath("sub_group", true)
225
+ base_project.save
226
+
227
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
228
+ new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
229
+ theirs_project["new_group"].move(new_group2)
230
+
231
+ changes_to_apply = get_diff(theirs_project, base_project)
232
+
233
+ described_class.apply_change_to_project(base_project, changes_to_apply)
234
+
235
+ expect(base_project).to be_equivalent_to_project(theirs_project)
236
+ end
237
+
238
+ it "moves a group with a group with a file in it" do
239
+ new_group = base_project.main_group.find_subpath("new_group", true)
240
+ sub_group = new_group.find_subpath("sub_group", true)
241
+ sub_group.new_reference("new_file")
242
+ base_project.save
243
+
244
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
245
+ new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
246
+ theirs_project["new_group"].move(new_group2)
247
+
248
+ changes_to_apply = get_diff(theirs_project, base_project)
249
+
250
+ described_class.apply_change_to_project(base_project, changes_to_apply)
251
+
252
+ expect(base_project).to be_equivalent_to_project(theirs_project)
253
+ end
254
+
206
255
  it "adds file with include in index and last known file type as nil" do
207
256
  theirs_project = create_copy_of_project(base_project.path, "theirs")
208
257
  file_reference = theirs_project.main_group.new_reference("#{filepath}.h")
@@ -595,6 +644,22 @@ describe Kintsugi, :apply_change_to_project do
595
644
  expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
596
645
  end
597
646
 
647
+ it "adds build when there is a build file without file ref" do
648
+ target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
649
+ target.frameworks_build_phase.add_file_reference(nil)
650
+ base_project.save
651
+
652
+ theirs_project = create_copy_of_project(base_project.path, "theirs")
653
+ file_reference = theirs_project.main_group.new_reference("bar")
654
+ theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
655
+
656
+ changes_to_apply = get_diff(theirs_project, base_project)
657
+ other_project = create_copy_of_project(base_project.path, "theirs")
658
+ described_class.apply_change_to_project(other_project, changes_to_apply)
659
+
660
+ expect(other_project).to be_equivalent_to_project(theirs_project)
661
+ end
662
+
598
663
  it "adds product ref to build file" do
599
664
  base_project.main_group.new_reference("bar")
600
665
  base_project.save
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.1
4
+ version: 0.6.2
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-08-29 00:00:00.000000000 Z
11
+ date: 2022-09-12 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.21
171
+ rubygems_version: 3.3.22
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: pbxproj files git conflicts solver