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
a24144fb
Commit
a24144fb
authored
Aug 09, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Git] Init submodules only after the checkout. #451
parent
c4f3a5df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
git.rb
lib/cocoapods/downloader/git.rb
+7
-12
downloader_spec.rb
spec/functional/downloader_spec.rb
+1
-1
No files found.
lib/cocoapods/downloader/git.rb
View file @
a24144fb
...
@@ -30,7 +30,7 @@ module Pod
...
@@ -30,7 +30,7 @@ module Pod
puts
"-> Creating cache git repo (
#{
cache_path
}
)"
if
config
.
verbose?
puts
"-> Creating cache git repo (
#{
cache_path
}
)"
if
config
.
verbose?
cache_path
.
rmtree
if
cache_path
.
exist?
cache_path
.
rmtree
if
cache_path
.
exist?
cache_path
.
mkpath
cache_path
.
mkpath
clone
(
url
,
cache_path
)
git
%Q|clone "
#{
url
}
" "
#{
cache_path
}
"|
end
end
def
prune_cache
def
prune_cache
...
@@ -95,7 +95,6 @@ module Pod
...
@@ -95,7 +95,6 @@ module Pod
def
ensure_remote_branch_exists
(
branch
)
def
ensure_remote_branch_exists
(
branch
)
Dir
.
chdir
(
cache_path
)
{
git
"branch -r | grep
#{
branch
}
$"
}
# check for remote branch and do suffix matching ($ anchor)
Dir
.
chdir
(
cache_path
)
{
git
"branch -r | grep
#{
branch
}
$"
}
# check for remote branch and do suffix matching ($ anchor)
return
if
$?
==
0
return
if
$?
==
0
raise
Informative
,
"[!] Cache unable to find git reference `
#{
branch
}
' for `
#{
url
}
' (
#{
$?
}
)."
.
red
raise
Informative
,
"[!] Cache unable to find git reference `
#{
branch
}
' for `
#{
url
}
' (
#{
$?
}
)."
.
red
end
end
...
@@ -105,7 +104,8 @@ module Pod
...
@@ -105,7 +104,8 @@ module Pod
else
else
create_cache
create_cache
end
end
clone
(
clone_url
,
target_path
)
git
%Q|clone "
#{
clone_url
}
" "
#{
target_path
}
"|
Dir
.
chdir
(
target_path
)
{
git
"submodule update --init"
}
end
end
def
download_tag
def
download_tag
...
@@ -122,27 +122,22 @@ module Pod
...
@@ -122,27 +122,22 @@ module Pod
def
download_commit
def
download_commit
ensure_ref_exists
(
options
[
:commit
])
ensure_ref_exists
(
options
[
:commit
])
clone
(
clone_url
,
target_path
)
git
%Q|clone "
#{
clone_url
}
" "
#{
target_path
}
"|
Dir
.
chdir
(
target_path
)
do
Dir
.
chdir
(
target_path
)
do
git
"checkout -b activated-pod-commit
#{
options
[
:commit
]
}
"
git
"checkout -b activated-pod-commit
#{
options
[
:commit
]
}
"
git
"submodule update --init"
end
end
end
end
def
download_branch
def
download_branch
ensure_remote_branch_exists
(
options
[
:branch
])
ensure_remote_branch_exists
(
options
[
:branch
])
clone
(
clone_url
,
target_path
)
git
%Q|clone "
#{
clone_url
}
" "
#{
target_path
}
"|
Dir
.
chdir
(
target_path
)
do
Dir
.
chdir
(
target_path
)
do
git
"remote add upstream '
#{
@url
}
'"
# we need to add the original url, not the cache url
git
"remote add upstream '
#{
@url
}
'"
# we need to add the original url, not the cache url
git
"fetch -q upstream"
# refresh the branches
git
"fetch -q upstream"
# refresh the branches
git
"checkout --track -b activated-pod-commit upstream/
#{
options
[
:branch
]
}
"
# create a new tracking branch
git
"checkout --track -b activated-pod-commit upstream/
#{
options
[
:branch
]
}
"
# create a new tracking branch
puts
"Just downloaded and checked out branch:
#{
options
[
:branch
]
}
from upstream
#{
clone_url
}
"
if
config
.
verbose?
end
end
def
clone
(
from
,
to
)
git
"clone
\"
#{
from
}
\"
\"
#{
to
}
\"
"
Dir
.
chdir
(
to
)
do
git
"submodule update --init"
git
"submodule update --init"
puts
"Just downloaded and checked out branch:
#{
options
[
:branch
]
}
from upstream
#{
clone_url
}
"
if
config
.
verbose?
end
end
end
end
end
end
...
...
spec/functional/downloader_spec.rb
View file @
a24144fb
...
@@ -177,7 +177,7 @@ module Pod
...
@@ -177,7 +177,7 @@ module Pod
(
pod
.
root
+
'test.txt'
).
should
.
exist?
(
pod
.
root
+
'test.txt'
).
should
.
exist?
end
end
it
"doesn't update
s cache t
he if the ref is available"
do
it
"doesn't update
the cac
he if the ref is available"
do
@pod
.
top_specification
.
stubs
(
:source
).
returns
(
@pod
.
top_specification
.
stubs
(
:source
).
returns
(
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'fd56054'
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'fd56054'
)
)
...
...
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