diff options
| author | Jack Nagel | 2014-07-05 17:11:08 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-05 17:26:07 -0500 |
| commit | 9a9328eef485e8321e1242b4a291215fde959198 (patch) | |
| tree | a16260c9bd48959114d5938cb1534fb2dd356b00 /Library | |
| parent | 6c91c0806f6295ed9aa650e2cfc298aa864d886b (diff) | |
| download | brew-9a9328eef485e8321e1242b4a291215fde959198.tar.bz2 | |
brew-pull: use diff-tree and simplify diff parsing
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-pull.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Library/Contributions/cmd/brew-pull.rb b/Library/Contributions/cmd/brew-pull.rb index 24294320b..f75174c73 100755 --- a/Library/Contributions/cmd/brew-pull.rb +++ b/Library/Contributions/cmd/brew-pull.rb @@ -80,12 +80,22 @@ ARGV.named.each do |arg| changed_formulae = [] - `git diff #{revision}.. --name-status`.each_line do |line| + + if tap_dir + formula_dir = %w[Formula HomebrewFormula].find { |d| tap_dir.join(d).directory? } || "" + else + formula_dir = "Library/Formula" + end + + Utils.popen_read( + "git", "diff-tree", "-r", "--name-status", + revision, "HEAD", "--", formula_dir, &:read + ).each_line do |line| status, filename = line.split # Don't try and do anything to removed files. - if (status =~ /A|M/) && (filename =~ %r{Formula/.+\.rb$}) || tap(url) - formula_name = File.basename(filename, '.rb') - formula = Formula[formula_name] rescue nil + if status == "A" || status == "M" + name = File.basename(filename, ".rb") + formula = Formula[name] rescue nil next unless formula changed_formulae << formula end @@ -118,7 +128,7 @@ ARGV.named.each do |arg| end ohai 'Patch changed:' - safe_system 'git', '--no-pager', 'diff', "#{revision}..", '--stat' + safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD" if ARGV.include? '--install' changed_formulae.each do |f| |
