brew-pull: Add flag to suppress whitespace fixes

When the pull request includes a patch, fixing whitespace can break the patch.
This commit is contained in:
Charlie Sharpsteen 2011-10-24 18:51:02 -07:00
parent cbdb603838
commit d54e7fb4de

View File

@ -13,7 +13,7 @@ if ARGV.empty?
end
HOMEBREW_REPOSITORY.cd do
ARGV.each do|arg|
ARGV.named.each do|arg|
if arg.to_i > 0
url = 'https://github.com/mxcl/homebrew/pull/' + arg + '.patch'
else
@ -38,13 +38,17 @@ HOMEBREW_REPOSITORY.cd do
# Makes sense to squash whitespace errors, we don't want them.
ohai 'Applying patch'
safe_system 'git', 'am', '--signoff', '--whitespace=fix', patchpath
patch_args = %w[am --signoff]
patch_args << '--whitespace=fix' unless ARGV.include? '--ignore-whitespace'
patch_args << patchpath
safe_system 'git', *patch_args
issue = arg.to_i > 0 ? arg.to_i : urlmatch[2]
if issue
ohai "Patch closes issue ##{issue}"
message = `git log HEAD^.. --format=%B`
# If this is a pull request, append a close message.
if !message.include? 'Closes #'
issueline = "Closes ##{issue}."