From e460dac109fb9fcd3191f3cb01152e5a665cb4f3 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Fri, 11 Aug 2023 19:28:45 +0000 Subject: [PATCH] Set default value newly gitlinks from applied patches. Bug: 1471685 Change-Id: I850778f030f77bda746227c3e2fde4bbaee55a3c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4775447 Reviewed-by: Josip Sokcevic Commit-Queue: Joanna Wang Auto-Submit: Joanna Wang --- gclient.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gclient.py b/gclient.py index 64a9ccf087..c020c09135 100755 --- a/gclient.py +++ b/gclient.py @@ -995,9 +995,17 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): path = module['path'] else: path = f'{self.name}/{module["path"]}' + # TODO(crbug.com/1471685): Temporary hack. In case of applied patches + # where the changes are staged but not committed, any gitlinks from + # the patch are not returned by `git ls-tree`. The path won't be found + # in commit_hashes. Use a temporary '0000000' value that will be replaced + # with w/e is found in DEPS later. submodules[path] = { - 'dep_type': 'git', - 'url': '{}@{}'.format(module['url'], commit_hashes[module['path']]) + 'dep_type': + 'git', + 'url': + '{}@{}'.format(module['url'], + commit_hashes.get(module['path'], '0000000')) } if 'gclient-condition' in module: