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
4b88a6a0
Unverified
Commit
4b88a6a0
authored
Nov 19, 2016
by
Danielle Tomlinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Sources] reset --hard rather than git pull
parent
5c0989aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
20 deletions
+49
-20
CHANGELOG.md
CHANGELOG.md
+4
-0
sources_manager.rb
lib/cocoapods/sources_manager.rb
+4
-2
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+41
-18
No files found.
CHANGELOG.md
View file @
4b88a6a0
...
@@ -25,6 +25,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -25,6 +25,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Johannes Plunien
](
https://github.com/plu
)
[
Johannes Plunien
](
https://github.com/plu
)
[
#5512
](
https://github.com/CocoaPods/CocoaPods/issues/5512
)
[
#5512
](
https://github.com/CocoaPods/CocoaPods/issues/5512
)
*
Use fetch and reset rather than a pull when updating specs repos.
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#6206
](
https://github.com/CocoaPods/CocoaPods/pull/6206
)
##### Bug Fixes
##### Bug Fixes
*
Fix default LD_RUNPATH_SEARCH_PATHS for host targets.
*
Fix default LD_RUNPATH_SEARCH_PATHS for host targets.
...
...
lib/cocoapods/sources_manager.rb
View file @
4b88a6a0
...
@@ -104,7 +104,9 @@ module Pod
...
@@ -104,7 +104,9 @@ module Pod
def
update_git_repo
(
show_output
=
false
)
def
update_git_repo
(
show_output
=
false
)
Config
.
instance
.
with_changes
(
:verbose
=>
show_output
)
do
Config
.
instance
.
with_changes
(
:verbose
=>
show_output
)
do
git!
([
'-C'
,
repo
,
'pull'
,
'--ff-only'
])
git!
(
%W(-C
#{
repo
}
fetch origin)
)
current_branch
=
git!
(
%W(-C
#{
repo
}
rev-parse --abbrev-ref HEAD)
).
strip
git!
(
%W(-C
#{
repo
}
reset --hard origin/
#{
current_branch
}
)
)
end
end
rescue
rescue
raise
Informative
,
'CocoaPods was not able to update the '
\
raise
Informative
,
'CocoaPods was not able to update the '
\
...
@@ -118,7 +120,7 @@ module Pod
...
@@ -118,7 +120,7 @@ module Pod
def
update_git_repo
(
show_output
=
false
)
def
update_git_repo
(
show_output
=
false
)
if
repo
.
join
(
'.git'
,
'shallow'
).
file?
if
repo
.
join
(
'.git'
,
'shallow'
).
file?
UI
.
info
"Performing a deep fetch of the `
#{
name
}
` specs repo to improve future performance"
do
UI
.
info
"Performing a deep fetch of the `
#{
name
}
` specs repo to improve future performance"
do
git!
(
[
'-C'
,
repo
,
'fetch'
,
'--unshallow'
]
)
git!
(
%W(-C
#{
repo
}
fetch --unshallow)
)
end
end
end
end
super
super
...
...
spec/unit/sources_manager_spec.rb
View file @
4b88a6a0
...
@@ -90,16 +90,24 @@ module Pod
...
@@ -90,16 +90,24 @@ module Pod
it
'updates source backed by a git repository'
do
it
'updates source backed by a git repository'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
pull --ff-only)
.
join
(
' '
)
end
@sources_manager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
end
it
'uses the only fast forward git option'
do
repo_update
=
sequence
(
'repo update'
)
set_up_test_repo_for_update
MasterSource
.
any_instance
.
MasterSource
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
expects
(
:git!
).
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
with
(
%W(-C
#{
test_repo_path
}
fetch origin)
).
in_sequence
(
repo_update
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
rev-parse --abbrev-ref HEAD)
).
returns
(
"my-special-branch
\n
"
).
in_sequence
(
repo_update
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
reset --hard origin/my-special-branch)
).
in_sequence
(
repo_update
)
@sources_manager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
@sources_manager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
end
end
...
@@ -107,12 +115,29 @@ module Pod
...
@@ -107,12 +115,29 @@ module Pod
set_up_test_repo_for_update
set_up_test_repo_for_update
test_repo_path
.
join
(
'.git'
,
'shallow'
).
open
(
'w'
)
{
|
f
|
f
<<
'a'
*
40
}
test_repo_path
.
join
(
'.git'
,
'shallow'
).
open
(
'w'
)
{
|
f
|
f
<<
'a'
*
40
}
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
fetch --unshallow)
.
join
(
' '
)
repo_update
=
sequence
(
'repo update'
)
end
MasterSource
.
any_instance
.
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
expects
(
:git!
).
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
pull --ff-only)
.
join
(
' '
)
with
(
%W(-C
#{
test_repo_path
}
fetch --unshallow)
).
end
in_sequence
(
repo_update
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
fetch origin)
).
in_sequence
(
repo_update
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
rev-parse --abbrev-ref HEAD)
).
returns
(
"master
\n
"
).
in_sequence
(
repo_update
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
reset --hard origin/master)
).
in_sequence
(
repo_update
)
@sources_manager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
@sources_manager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
UI
.
output
.
should
.
match
/deep fetch.+`master`.+improve future performance/
UI
.
output
.
should
.
match
/deep fetch.+`master`.+improve future performance/
...
@@ -126,9 +151,7 @@ module Pod
...
@@ -126,9 +151,7 @@ module Pod
Source
.
any_instance
.
stubs
(
:git
).
with
do
|
options
|
Source
.
any_instance
.
stubs
(
:git
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
diff --name-only aabbccd..HEAD)
.
join
(
' '
)
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
diff --name-only aabbccd..HEAD)
.
join
(
' '
)
end
.
returns
(
''
)
end
.
returns
(
''
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
fetch origin)
).
raises
(
<<-
EOS
)
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
pull --ff-only)
.
join
(
' '
)
end
.
raises
(
<<-
EOS
)
fatal: '/dev/null' does not appear to be a git repository
fatal: '/dev/null' does not appear to be a git repository
fatal: Could not read from remote repository.
fatal: Could not read from remote repository.
...
...
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