Improve brew pull to close issues.
This commit is contained in:
parent
d6455e0094
commit
dc3623f5a6
@ -16,7 +16,8 @@ end
|
|||||||
HOMEBREW_REPOSITORY.cd do
|
HOMEBREW_REPOSITORY.cd do
|
||||||
ARGV.each do|arg|
|
ARGV.each do|arg|
|
||||||
# This regex should work, if it's too precise, feel free to fix it.
|
# This regex should work, if it's too precise, feel free to fix it.
|
||||||
if !arg.match 'https:\/\/github.com\/\w+\/homebrew\/(pull\/\d+|commit\/\w{4,40})'
|
urlmatch = arg.match 'https:\/\/github.com\/\w+\/homebrew\/(pull\/(\d+)|commit\/\w{4,40})'
|
||||||
|
if !urlmatch
|
||||||
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
@ -32,6 +33,20 @@ HOMEBREW_REPOSITORY.cd do
|
|||||||
ohai 'Applying patch'
|
ohai 'Applying patch'
|
||||||
safe_system 'git', 'am', '--signoff', '--whitespace=fix', patchpath
|
safe_system 'git', 'am', '--signoff', '--whitespace=fix', patchpath
|
||||||
|
|
||||||
|
issue = urlmatch[2]
|
||||||
|
if issue
|
||||||
|
ohai "Patch closes issue ##{issue}"
|
||||||
|
message = `git log HEAD^..HEAD --format=%B`
|
||||||
|
|
||||||
|
# If this is a pull request, append a close message.
|
||||||
|
if !message.include? 'Closes #'
|
||||||
|
issueline = "Closes ##{issue}."
|
||||||
|
signed = 'Signed-off-by:'
|
||||||
|
message = message.gsub signed, issueline + "\n\n" + signed
|
||||||
|
safe_system 'git', 'commit', '--amend', '-q', '-m', message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ohai 'Patch changed:'
|
ohai 'Patch changed:'
|
||||||
safe_system 'git', 'diff', 'HEAD^..HEAD', '--stat'
|
safe_system 'git', 'diff', 'HEAD^..HEAD', '--stat'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user