diff options
| author | Xu Cheng | 2015-04-01 20:31:17 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-05-08 15:48:51 +0800 |
| commit | fa9371e58e948c284cf8492557b3d1f19e459770 (patch) | |
| tree | ff7bd50c84e17cb40ee4b8246f0b1d99f6040307 | |
| parent | 9daeef5d9537f76f24d623f28c513e78f59457ab (diff) | |
| download | brew-fa9371e58e948c284cf8492557b3d1f19e459770.tar.bz2 | |
tap: support fast clone
Closes Homebrew/homebrew#37592.
Closes Homebrew/homebrew#38268.
Signed-off-by: Xu Cheng <xucheng@me.com>
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/brew.1.md | 4 | ||||
| -rw-r--r-- | share/man/man1/brew.1 | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 34db5a9e4..5e0554dbb 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -20,7 +20,9 @@ module Homebrew tapd = HOMEBREW_LIBRARY/"Taps/#{user.downcase}/homebrew-#{repo.downcase}" return false if tapd.directory? 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 = [] tapd.find_formula { |file| files << file } @@ -109,7 +111,7 @@ module Homebrew end end - def tap_args(tap_name=ARGV.first) + def tap_args(tap_name=ARGV.named.first) tap_name =~ HOMEBREW_TAP_ARGS_REGEX raise "Invalid tap name" unless $1 && $3 [$1, $3] diff --git a/Library/Homebrew/manpages/brew.1.md b/Library/Homebrew/manpages/brew.1.md index c7a2206a4..d22373517 100644 --- a/Library/Homebrew/manpages/brew.1.md +++ b/Library/Homebrew/manpages/brew.1.md @@ -345,11 +345,13 @@ Note that these flags should only appear after a command. * `switch` <name> <version>: 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> is of the form <user>/<repo>, e.g. `brew tap homebrew/dupes`. + If `--full` is passed, a full clone will be used. + * `tap --repair`: Ensure all tapped formulae are symlinked into Library/Formula and prune dead formulae from Library/Formula. diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index 4997ce171..08c54d0cd 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -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\. . .TP -\fBtap\fR [\fItap\fR] +\fBtap\fR [\-\-full] [\fItap\fR] Tap a new formula repository from GitHub, or list existing taps\. . .IP \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 \fBtap \-\-repair\fR Ensure all tapped formulae are symlinked into Library/Formula and prune dead formulae from Library/Formula\. |
