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
a57091f7
Commit
a57091f7
authored
Feb 07, 2014
by
Eloy Durán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command] Add `pod repo add --shallow` option. Default to false.
parent
63feac1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
repo.rb
lib/cocoapods/command/repo.rb
+14
-2
repo_spec.rb
spec/functional/command/repo_spec.rb
+11
-0
No files found.
lib/cocoapods/command/repo.rb
View file @
a57091f7
...
@@ -19,7 +19,14 @@ module Pod
...
@@ -19,7 +19,14 @@ module Pod
self
.
arguments
=
'NAME URL [BRANCH]'
self
.
arguments
=
'NAME URL [BRANCH]'
def
self
.
options
[
[
"--shallow"
,
"Create a shallow clone (fast clone, but no push capabilities)"
],
].
concat
(
super
)
end
def
initialize
(
argv
)
def
initialize
(
argv
)
@shallow
=
argv
.
flag?
(
'shallow'
,
false
)
@name
,
@url
,
@branch
=
argv
.
shift_argument
,
argv
.
shift_argument
,
argv
.
shift_argument
@name
,
@url
,
@branch
=
argv
.
shift_argument
,
argv
.
shift_argument
,
argv
.
shift_argument
super
super
end
end
...
@@ -32,9 +39,14 @@ module Pod
...
@@ -32,9 +39,14 @@ module Pod
end
end
def
run
def
run
UI
.
section
(
"Cloning spec repo `
#{
@name
}
` from `
#{
@url
}
`
#{
" (branch `
#{
@branch
}
`)"
if
@branch
}
"
)
do
prefix
=
@shallow
?
'Creating shallow clone of'
:
'Cloning'
UI
.
section
(
"
#{
prefix
}
spec repo `
#{
@name
}
` from `
#{
@url
}
`
#{
" (branch `
#{
@branch
}
`)"
if
@branch
}
"
)
do
config
.
repos_dir
.
mkpath
config
.
repos_dir
.
mkpath
Dir
.
chdir
(
config
.
repos_dir
)
{
git!
(
"clone --depth=1 '
#{
@url
}
'
#{
@name
}
"
)
}
Dir
.
chdir
(
config
.
repos_dir
)
do
command
=
"clone '
#{
@url
}
'
#{
@name
}
"
command
<<
' --depth=1'
if
@shallow
git!
(
command
)
end
Dir
.
chdir
(
dir
)
{
git!
(
"checkout
#{
@branch
}
"
)
}
if
@branch
Dir
.
chdir
(
dir
)
{
git!
(
"checkout
#{
@branch
}
"
)
}
if
@branch
SourcesManager
.
check_version_information
(
dir
)
SourcesManager
.
check_version_information
(
dir
)
end
end
...
...
spec/functional/command/repo_spec.rb
View file @
a57091f7
...
@@ -46,6 +46,17 @@ module Pod
...
@@ -46,6 +46,17 @@ module Pod
Dir
.
chdir
(
repo2
.
dir
)
{
`git symbolic-ref HEAD`
}.
should
.
include?
'my-branch'
Dir
.
chdir
(
repo2
.
dir
)
{
`git symbolic-ref HEAD`
}.
should
.
include?
'my-branch'
end
end
it
"adds a spec-repo by creating a shallow clone"
do
Dir
.
chdir
(
test_repo_path
)
do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
# Need to use file:// to test local use of --depth=1
run_command
(
'repo'
,
'add'
,
'private'
,
'--shallow'
,
"file://
#{
test_repo_path
}
"
)
Dir
.
chdir
(
config
.
repos_dir
+
'private'
)
do
`git log --pretty=oneline`
.
strip
.
split
(
"
\n
"
).
size
.
should
==
1
end
end
it
"updates a spec-repo"
do
it
"updates a spec-repo"
do
repo1
=
repo_make
(
'repo1'
)
repo1
=
repo_make
(
'repo1'
)
repo2
=
repo_clone
(
'repo1'
,
'repo2'
)
repo2
=
repo_clone
(
'repo1'
,
'repo2'
)
...
...
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