Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
7395fa95
Commit
7395fa95
authored
Sep 13, 2017
by
Dimitris Koutsogiorgas
Committed by
GitHub
Sep 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7028 from amorde/cocoapods-6979
Fix common paths sometimes calculating incorrectly
parents
6d6d6bb3
f3650d11
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
CHANGELOG.md
CHANGELOG.md
+4
-0
file_references_installer.rb
...xcode/pods_project_generator/file_references_installer.rb
+5
-3
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+12
-0
No files found.
CHANGELOG.md
View file @
7395fa95
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
Fix common paths sometimes calculating incorrectly
[
amorde
](
https://github.com/amorde
)
[
#7028
](
https://github.com/CocoaPods/CocoaPods/pull/7028
)
*
Do not code sign OSX targets for testing bundles
*
Do not code sign OSX targets for testing bundles
[
Justin Martin
](
https://github.com/justinseanmartin
)
[
Justin Martin
](
https://github.com/justinseanmartin
)
[
#7027
](
https://github.com/CocoaPods/CocoaPods/pull/7027
)
[
#7027
](
https://github.com/CocoaPods/CocoaPods/pull/7027
)
...
...
lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb
View file @
7395fa95
...
@@ -242,7 +242,7 @@ module Pod
...
@@ -242,7 +242,7 @@ module Pod
end
end
# Returns a Pathname of the nearest parent from which all the given paths descend.
# Returns a Pathname of the nearest parent from which all the given paths descend.
# Converts each Pathname to a
string
and finds the longest common prefix
# Converts each Pathname to a
list of path components
and finds the longest common prefix
#
#
# @param [Array<Pathname>] paths
# @param [Array<Pathname>] paths
# The paths to files or directories on disk. Must be absolute paths
# The paths to files or directories on disk. Must be absolute paths
...
@@ -258,10 +258,12 @@ module Pod
...
@@ -258,10 +258,12 @@ module Pod
path
.
dirname
.
to_s
path
.
dirname
.
to_s
end
end
min
,
max
=
strs
.
minmax
min
,
max
=
strs
.
minmax
min
=
min
.
split
(
'/'
)
max
=
max
.
split
(
'/'
)
idx
=
min
.
size
.
times
{
|
i
|
break
i
if
min
[
i
]
!=
max
[
i
]
}
idx
=
min
.
size
.
times
{
|
i
|
break
i
if
min
[
i
]
!=
max
[
i
]
}
result
=
Pathname
.
new
(
min
[
0
...
idx
])
result
=
Pathname
.
new
(
min
[
0
...
idx
]
.
join
(
'/'
)
)
# Don't consider "/" a common path
# Don't consider "/" a common path
return
result
unless
result
.
to_s
==
'/'
return
result
unless
result
.
to_s
==
'
'
||
result
.
to_s
==
'
/'
end
end
# Computes the destination sub-directory in the sandbox
# Computes the destination sub-directory in the sandbox
...
...
spec/unit/installer/xcode/pods_project_generator/file_references_installer_spec.rb
View file @
7395fa95
...
@@ -252,6 +252,18 @@ module Pod
...
@@ -252,6 +252,18 @@ module Pod
result
.
should
==
Pathname
.
new
(
'/Base/Sub/A'
)
result
.
should
==
Pathname
.
new
(
'/Base/Sub/A'
)
end
end
it
'compares path components instead of string prefixes'
do
paths
=
[
'/Base/Sub/A/1.txt'
,
'/Base/Sub/AA/2.txt'
,
'/Base/Sub/AAA/B/1.txt'
,
'/Base/Sub/AAAA/B/2.txt'
,
'/Base/Sub/AAAAA/D/E/1.txt'
,
].
map
{
|
p
|
Pathname
.
new
(
p
)
}
result
=
@installer
.
send
(
:common_path
,
paths
)
result
.
should
==
Pathname
.
new
(
'/Base/Sub'
)
end
it
'should not consider root \'/\' a common path'
do
it
'should not consider root \'/\' a common path'
do
paths
=
[
paths
=
[
'/A/B/C'
,
'/A/B/C'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment