diff options
| author | Jack Nagel | 2014-07-25 10:42:47 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-25 12:25:58 -0500 |
| commit | 2cf116464dcdd68c10e8a9e6f918568cf594a588 (patch) | |
| tree | 34fbf356c7b9ab6c37f3f24373617566fb73df96 /Library/Homebrew/cmd | |
| parent | cd02d3d540b04bc58f687017fb277decb4a05d98 (diff) | |
| download | brew-2cf116464dcdd68c10e8a9e6f918568cf594a588.tar.bz2 | |
update: simplify diff parsing
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 4040d343e..5fe9341af 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -168,20 +168,17 @@ class Updater end end - # Matches raw git diff format (see `man git-diff-tree`) - DIFFTREE_RX = /^:[0-7]{6} [0-7]{6} [0-9a-fA-F]{40} [0-9a-fA-F]{40} ([ACDMRTUX])\d{0,3}\t(.+?)(?:\t(.+))?$/ - def report map = Hash.new{ |h,k| h[k] = [] } if initial_revision && initial_revision != current_revision - `git diff-tree -r --raw -M85% #{initial_revision} #{current_revision}`.each_line do |line| - DIFFTREE_RX.match line - path = case status = $1.to_sym - when :R then $3 - else $2 - end - map[status] << repository.join(path) + `git diff-tree -r --name-status -M85% #{initial_revision} #{current_revision}`.each_line do |line| + status, path, renamed = line.split + if renamed + status = status[0, 1] + path = renamed + end + map[status.to_sym] << repository.join(path) end end |
