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
fb19f1dd
Commit
fb19f1dd
authored
Dec 10, 2016
by
Danielle Tomlinson
Committed by
GitHub
Dec 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6206 from CocoaPods/dani_reset_updates
[Sources] reset --hard rather than git pull
parents
5c0989aa
4b88a6a0
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 @
fb19f1dd
...
...
@@ -25,6 +25,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Johannes Plunien
](
https://github.com/plu
)
[
#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
*
Fix default LD_RUNPATH_SEARCH_PATHS for host targets.
...
...
lib/cocoapods/sources_manager.rb
View file @
fb19f1dd
...
...
@@ -104,7 +104,9 @@ module Pod
def
update_git_repo
(
show_output
=
false
)
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
rescue
raise
Informative
,
'CocoaPods was not able to update the '
\
...
...
@@ -118,7 +120,7 @@ module Pod
def
update_git_repo
(
show_output
=
false
)
if
repo
.
join
(
'.git'
,
'shallow'
).
file?
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
super
...
...
spec/unit/sources_manager_spec.rb
View file @
fb19f1dd
...
...
@@ -90,16 +90,24 @@ module Pod
it
'updates source backed by a git repository'
do
set_up_test_repo_for_update
@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
set_up_test_repo_for_update
MasterSource
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
@sources_manager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
repo_update
=
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
(
"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
)
end
...
...
@@ -107,12 +115,29 @@ module Pod
set_up_test_repo_for_update
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
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
fetch --unshallow)
.
join
(
' '
)
end
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
pull --ff-only)
.
join
(
' '
)
end
repo_update
=
sequence
(
'repo update'
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
fetch --unshallow)
).
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
)
UI
.
output
.
should
.
match
/deep fetch.+`master`.+improve future performance/
...
...
@@ -126,9 +151,7 @@ module Pod
Source
.
any_instance
.
stubs
(
:git
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
diff --name-only aabbccd..HEAD)
.
join
(
' '
)
end
.
returns
(
''
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
do
|
options
|
options
.
join
(
' '
)
==
%W(-C
#{
test_repo_path
}
pull --ff-only)
.
join
(
' '
)
end
.
raises
(
<<-
EOS
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%W(-C
#{
test_repo_path
}
fetch origin)
).
raises
(
<<-
EOS
)
fatal: '/dev/null' does not appear to be a git 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