From 03a1a8936e1471ed495c20c11b487de41838527b Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 1 Nov 2023 16:46:03 +0000 Subject: [PATCH] pre-commit: do not ignore submodule when running diff-index Without this line, if the git config specifies to ignore submodule change (what happned in the associated bug), this script is useless because the command will never return gitlink change R=sokcevic Bug: 1496925 Change-Id: I6536b95502e708e44d6fd3e4909fd30eac8c7c98 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4995364 Auto-Submit: Yiwei Zhang Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- hooks/pre-commit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/pre-commit.py b/hooks/pre-commit.py index 742f20fff1..60fa5c4b74 100644 --- a/hooks/pre-commit.py +++ b/hooks/pre-commit.py @@ -27,7 +27,8 @@ def main(): has_deps_diff = False staged_gitlinks = [] - diff = git_common.run('diff-index', '--cached', 'HEAD') + diff = git_common.run('diff-index', '--cached', '--ignore-submodules=dirty', + 'HEAD') for line in diff.splitlines(): path = line.split()[-1] if path == 'DEPS':