Commit d9363a8c authored by Robert Ma's avatar Robert Ma Committed by Chromium LUCI CQ

[blinkpy] Recurse into subtrees when checking diff

`git diff-tree` should be used with the `-r` flag if we want to recurse
into subtrees (e.g. to check if css/css-animations is affected by a
commit as opposed to just css/). This is the only place where we forgot
to do that and it has caused some false positives of "affecting this
directory" in our bug filing.

Fixed: 850088
Change-Id: Ifdd1b9eeba2c5749effdab1041d86c6500160ce7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590014
Commit-Queue: Robert Ma <robertma@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Auto-Submit: Robert Ma <robertma@chromium.org>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836670}
parent 2e7df8cf
...@@ -202,8 +202,8 @@ class LocalWPT(object): ...@@ -202,8 +202,8 @@ class LocalWPT(object):
def is_commit_affecting_directory(self, commit, directory): def is_commit_affecting_directory(self, commit, directory):
"""Checks if a commit affects a directory.""" """Checks if a commit affects a directory."""
exit_code = self.run([ exit_code = self.run([
'git', 'diff-tree', '--quiet', '--no-commit-id', commit, '--', 'git', 'diff-tree', '--quiet', '--no-commit-id', '-r', commit,
directory '--', directory
], ],
return_exit_code=True) return_exit_code=True)
return exit_code == 1 return exit_code == 1
......
...@@ -146,8 +146,8 @@ class LocalWPTTest(unittest.TestCase): ...@@ -146,8 +146,8 @@ class LocalWPTTest(unittest.TestCase):
self.assertTrue( self.assertTrue(
local_wpt.is_commit_affecting_directory('HEAD', 'css/')) local_wpt.is_commit_affecting_directory('HEAD', 'css/'))
self.assertEqual(host.executive.calls, [[ self.assertEqual(host.executive.calls, [[
'git', 'diff-tree', '--quiet', '--no-commit-id', 'HEAD', '--', 'git', 'diff-tree', '--quiet', '--no-commit-id', '-r', 'HEAD',
'css/' '--', 'css/'
]]) ]])
def test_seek_change_id(self): def test_seek_change_id(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment