tap: support fast clone
Closes Homebrew/homebrew#37592. Closes Homebrew/homebrew#38268. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
9daeef5d95
commit
fa9371e58e
@ -20,7 +20,9 @@ module Homebrew
|
|||||||
tapd = HOMEBREW_LIBRARY/"Taps/#{user.downcase}/homebrew-#{repo.downcase}"
|
tapd = HOMEBREW_LIBRARY/"Taps/#{user.downcase}/homebrew-#{repo.downcase}"
|
||||||
return false if tapd.directory?
|
return false if tapd.directory?
|
||||||
ohai "Tapping #{repouser}/#{repo}"
|
ohai "Tapping #{repouser}/#{repo}"
|
||||||
abort unless system "git", "clone", "https://github.com/#{repouser}/homebrew-#{repo}", tapd.to_s
|
args = %W[clone https://github.com/#{repouser}/homebrew-#{repo} #{tapd}]
|
||||||
|
args << "--depth=1" unless ARGV.include?("--full")
|
||||||
|
safe_system "git", *args
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
tapd.find_formula { |file| files << file }
|
tapd.find_formula { |file| files << file }
|
||||||
@ -109,7 +111,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tap_args(tap_name=ARGV.first)
|
def tap_args(tap_name=ARGV.named.first)
|
||||||
tap_name =~ HOMEBREW_TAP_ARGS_REGEX
|
tap_name =~ HOMEBREW_TAP_ARGS_REGEX
|
||||||
raise "Invalid tap name" unless $1 && $3
|
raise "Invalid tap name" unless $1 && $3
|
||||||
[$1, $3]
|
[$1, $3]
|
||||||
|
@ -345,11 +345,13 @@ Note that these flags should only appear after a command.
|
|||||||
* `switch` <name> <version>:
|
* `switch` <name> <version>:
|
||||||
Symlink all of the specific <version> of <name>'s install to Homebrew prefix.
|
Symlink all of the specific <version> of <name>'s install to Homebrew prefix.
|
||||||
|
|
||||||
* `tap` [<tap>]:
|
* `tap` [--full] [<tap>]:
|
||||||
Tap a new formula repository from GitHub, or list existing taps.
|
Tap a new formula repository from GitHub, or list existing taps.
|
||||||
|
|
||||||
<tap> is of the form <user>/<repo>, e.g. `brew tap homebrew/dupes`.
|
<tap> is of the form <user>/<repo>, e.g. `brew tap homebrew/dupes`.
|
||||||
|
|
||||||
|
If `--full` is passed, a full clone will be used.
|
||||||
|
|
||||||
* `tap --repair`:
|
* `tap --repair`:
|
||||||
Ensure all tapped formulae are symlinked into Library/Formula and prune dead
|
Ensure all tapped formulae are symlinked into Library/Formula and prune dead
|
||||||
formulae from Library/Formula.
|
formulae from Library/Formula.
|
||||||
|
@ -369,12 +369,15 @@ Instantiate a Homebrew build environment\. Uses our years\-battle\-hardened Home
|
|||||||
Symlink all of the specific \fIversion\fR of \fIname\fR\'s install to Homebrew prefix\.
|
Symlink all of the specific \fIversion\fR of \fIname\fR\'s install to Homebrew prefix\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBtap\fR [\fItap\fR]
|
\fBtap\fR [\-\-full] [\fItap\fR]
|
||||||
Tap a new formula repository from GitHub, or list existing taps\.
|
Tap a new formula repository from GitHub, or list existing taps\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
\fItap\fR is of the form \fIuser\fR/\fIrepo\fR, e\.g\. \fBbrew tap homebrew/dupes\fR\.
|
\fItap\fR is of the form \fIuser\fR/\fIrepo\fR, e\.g\. \fBbrew tap homebrew/dupes\fR\.
|
||||||
.
|
.
|
||||||
|
.IP
|
||||||
|
If \fB\-\-full\fR is passed, a full clone will be used\.
|
||||||
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBtap \-\-repair\fR
|
\fBtap \-\-repair\fR
|
||||||
Ensure all tapped formulae are symlinked into Library/Formula and prune dead formulae from Library/Formula\.
|
Ensure all tapped formulae are symlinked into Library/Formula and prune dead formulae from Library/Formula\.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user