aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/update.rb
diff options
context:
space:
mode:
authorJack Nagel2014-07-26 20:11:53 -0500
committerJack Nagel2014-07-26 20:11:53 -0500
commita3ad8405f644870e0dfa3a69e22a23300048fffd (patch)
treeaf195b7f926c5c80e71f68eb189ed9c5a518f64e /Library/Homebrew/cmd/update.rb
parent3aa313a38d2e83da9d15765576ed7edc05ce6e14 (diff)
downloadhomebrew-a3ad8405f644870e0dfa3a69e22a23300048fffd.tar.bz2
Only populate the report with formula paths
Diffstat (limited to 'Library/Homebrew/cmd/update.rb')
-rw-r--r--Library/Homebrew/cmd/update.rb31
1 files changed, 28 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index d788bced6..ccb458e32 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -173,8 +173,18 @@ class Updater
if initial_revision && initial_revision != current_revision
diff.each_line do |line|
- status, path = line.split
- map[status.to_sym] << repository.join(path)
+ status, *paths = line.split
+
+ next unless File.extname(paths.last) == ".rb"
+ next unless File.dirname(paths.last) == formula_directory
+
+ case status
+ when "A", "M", "D"
+ map[status.to_sym] << repository.join(paths.first)
+ when /^R\d{0,3}/
+ map[:D] << repository.join(paths.first)
+ map[:A] << repository.join(paths.last)
+ end
end
end
@@ -183,12 +193,27 @@ class Updater
private
+ def formula_directory
+ if repository == HOMEBREW_REPOSITORY
+ "Library/Formula"
+ elsif repository.join("Formula").directory?
+ "Formula"
+ elsif repository.join("HomebrewFormula").directory?
+ "HomebrewFormula"
+ else
+ "."
+ end
+ end
+
def read_current_revision
`git rev-parse -q --verify HEAD`.chomp
end
def diff
- Utils.popen_read("git", "diff-tree", "-r", "--name-status", "--diff-filter=AMD", initial_revision, current_revision)
+ Utils.popen_read(
+ "git", "diff-tree", "-r", "--name-status", "--diff-filter=AMDR",
+ "-M85%", initial_revision, current_revision
+ )
end
def `(cmd)