We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29c7f84 commit 68d6cc6Copy full SHA for 68d6cc6
tool/auto-style.rb
@@ -15,8 +15,10 @@ def initialize(oldrev, newrev, branch = nil)
15
@branch = branch
16
17
# GitHub may not fetch github.event.pull_request.base.sha at checkout
18
- git('fetch', '--depth=1', 'origin', @oldrev)
19
- git('fetch', '--depth=100', 'origin', @newrev)
+ git('log', '--format=%H', '-1', @oldrev, out: IO::NULL, err: [:child, :out]) or
+ git('fetch', '--depth=1', 'origin', @oldrev)
20
+ git('log', '--format=%H', '-1', "#@newrev~99", out: IO::NULL, err: [:child, :out]) or
21
+ git('fetch', '--depth=100', 'origin', @newrev)
22
23
with_clean_env do
24
@revs = {}
@@ -66,12 +68,14 @@ def diff
66
68
67
69
private
70
- def git(*args)
71
+ def git(*args, **opts)
72
cmd = ['git', *args].shelljoin
73
puts "+ #{cmd}"
- unless with_clean_env { system('git', *args) }
74
+ ret = with_clean_env { system('git', *args, **opts) }
75
+ unless ret or opts[:err]
76
abort "Failed to run: #{cmd}"
77
end
78
+ ret
79
80
81
def with_clean_env
0 commit comments