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
5e3f797d
Commit
5e3f797d
authored
May 21, 2012
by
Sam Stewart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] ability to specify :branch in Podfiles and Podspecs
parent
326928c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
dependency.rb
lib/cocoapods/dependency.rb
+1
-0
git.rb
lib/cocoapods/downloader/git.rb
+24
-2
No files found.
lib/cocoapods/dependency.rb
View file @
5e3f797d
...
...
@@ -165,6 +165,7 @@ module Pod
def
description
"from `
#{
@params
[
:git
]
}
'"
.
tap
do
|
description
|
description
<<
", commit `
#{
@params
[
:commit
]
}
'"
if
@params
[
:commit
]
description
<<
", branch `
#{
@params
[
:branch
]
}
'"
if
@params
[
:branch
]
description
<<
", tag `
#{
@params
[
:tag
]
}
'"
if
@params
[
:tag
]
end
end
...
...
lib/cocoapods/downloader/git.rb
View file @
5e3f797d
...
...
@@ -14,8 +14,11 @@ module Pod
def
download
prepare_cache
puts
'->'
.
green
<<
' Cloning git repo'
if
config
.
verbose?
# if a branch is specified, it takes priority over a commit
if
options
[
:tag
]
download_tag
elsif
options
[
:branch
]
download_branch
elsif
options
[
:commit
]
download_commit
else
...
...
@@ -88,6 +91,13 @@ module Pod
raise
Informative
,
"[!] Cache unable to find git reference `
#{
ref
}
' for `
#{
url
}
'."
.
red
unless
$?
==
0
end
def
ensure_remote_branch_exists
(
branch
)
Dir
.
chdir
(
cache_path
)
{
git
"branch -r | grep
#{
branch
}
$"
}
# check for remote branch and do suffix matching ($ anchor)
return
if
$?
==
0
raise
Informative
,
"[!] Cache unable to find git reference `
#{
branch
}
' for `
#{
url
}
' (
#{
$?
}
)."
.
red
end
def
download_head
update_cache
git
"clone '
#{
clone_url
}
' '
#{
target_path
}
'"
...
...
@@ -111,7 +121,17 @@ module Pod
git
"checkout -b activated-pod-commit
#{
options
[
:commit
]
}
"
end
end
def
download_branch
ensure_remote_branch_exists
(
options
[
:branch
])
git
"clone '
#{
clone_url
}
' '
#{
target_path
}
'"
Dir
.
chdir
(
target_path
)
do
git
"remote add upstream
#{
@url
}
"
# we need to add the original url, not the cache url
git
"fetch -q upstream"
# refresh the branches
git
"checkout --track -b activated-pod-commit upstream/
#{
options
[
:branch
]
}
"
# create a new tracking branch
end
end
def
clean
(
target_path
+
'.git'
).
rmtree
end
...
...
@@ -129,7 +149,9 @@ module Pod
def
download_commit
download_only?
?
download_and_extract_tarball
(
options
[:
commit
])
:
super
end
def
download_branch
download_only
?
download_and_extract_tarball
(
options
[:
head
])
:
super
def
clean
if
download_only?
FileUtils
.
rm_f
(
tmp_path
)
...
...
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