aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/untap.rb
diff options
context:
space:
mode:
authorMax Howell2012-03-04 02:47:11 +0000
committerMax Howell2012-03-16 21:06:15 +0000
commita05a5fc8fb46b46ee59b791417a16dc0a2cfcd39 (patch)
tree9e517ea70e5268823c60f09a46e2c5f85d5c2b57 /Library/Homebrew/cmd/untap.rb
parentfb13b6a99e48984fc74675784f74cb409a4a7557 (diff)
downloadhomebrew-a05a5fc8fb46b46ee59b791417a16dc0a2cfcd39.tar.bz2
Prevent tapped symlinks showing up in git status
The symlinks taps write to Formula show up in git status, but this trick prevents this. brew-(un)tap maintain a .gitignore in Formula that contains all the symlinks brew-tap creates. We add the .gitignore to the root .gitignore and TADA! Magic.
Diffstat (limited to 'Library/Homebrew/cmd/untap.rb')
-rw-r--r--Library/Homebrew/cmd/untap.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb
index 78778e6fc..80d38934b 100644
--- a/Library/Homebrew/cmd/untap.rb
+++ b/Library/Homebrew/cmd/untap.rb
@@ -1,4 +1,5 @@
require 'cmd/tap' # for Pathname.recursive_formula
+require 'tempfile'
module Homebrew extend self
def untap
@@ -7,11 +8,19 @@ module Homebrew extend self
raise "No such tap!" unless tapd.directory?
+ gitignores = (HOMEBREW_PREFIX/"Library/Formula/.gitignore").read.split rescue []
+
tapd.find_formula do |pn|
- pn = HOMEBREW_REPOSITORY/"Library/Formula"/pn.basename
+ bn = pn.basename.to_s
+ pn = HOMEBREW_REPOSITORY/"Library/Formula"/bn
pn.delete if pn.symlink? and pn.realpath.to_s =~ %r[^#{tapd.realpath}]
+ gitignores.delete(bn)
end
-
rm_rf tapd
+
+ tf = Tempfile.new("brew-untap")
+ tf.write(gitignores.join("\n"))
+ tf.close
+ mv tf.path, "#{HOMEBREW_PREFIX}/Library/Formula/.gitignore"
end
end