Fix hook base paths when repo is not relative but parent is.

This makes hooks path behavior match deps path behavior.

Bug: 1468658
Change-Id: Ib6685cb52679249b389599ada549e2c4410e812c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4729084
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
changes/84/4729084/3
Joanna Wang 2 years ago committed by LUCI CQ
parent 8424103c4e
commit 59e1011541

@ -897,8 +897,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
hooks_cwd = self.root.root_dir hooks_cwd = self.root.root_dir
if self._use_relative_paths: if self._use_relative_paths:
hooks_cwd = os.path.join(hooks_cwd, self.name) hooks_cwd = os.path.join(hooks_cwd, self.name)
logging.warning('Updating hook base working directory to %s.', elif self._relative:
hooks_cwd) hooks_cwd = os.path.join(hooks_cwd, os.path.dirname(self.name))
logging.warning('Using hook base working directory: %s.', hooks_cwd)
# Only add all hooks if we should sync, otherwise just add custom hooks. # Only add all hooks if we should sync, otherwise just add custom hooks.
# override named sets of hooks by the custom hooks # override named sets of hooks by the custom hooks

@ -451,7 +451,7 @@ class GclientTest(trial_dir.TestCase):
self.assertEqual( self.assertEqual(
[(h.action, h.effective_cwd) for h in self._get_hooks()], [(h.action, h.effective_cwd) for h in self._get_hooks()],
[(('tata', 'titi'), self.root_dir), [(('tata', 'titi'), os.path.join(self.root_dir, 'foo')),
(('fire', 'lazors'), os.path.join(self.root_dir, 'foo/baz'))]) (('fire', 'lazors'), os.path.join(self.root_dir, 'foo/baz'))])
def testTargetOS(self): def testTargetOS(self):

Loading…
Cancel
Save