Set ignoreSubmodule=all for all repos.

Bug: 1415507

Change-Id: I840508c6972e4640793a12aba287ed8dedfe64c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4641611
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
changes/11/4641611/3
Joanna Wang 2 years ago committed by LUCI CQ
parent 90fed30866
commit e1753f63df

@ -559,6 +559,22 @@ class GitWrapper(SCMWrapper):
(e.returncode, e.stderr.decode('utf-8')))
return True
def set_config(f):
def wrapper(*args):
return_val = f(*args)
if os.path.exists(os.path.join(args[0].checkout_path, '.git')):
# If diff.ignoreSubmodules is not already set, set it to `all`.
currentIgnore = subprocess2.capture(
['git', 'config', '--get', 'diff.ignoreSubmodules'],
cwd=args[0].checkout_path).strip()
if not currentIgnore:
subprocess2.capture(['git', 'config', 'diff.ignoreSubmodules', 'all'],
cwd=args[0].checkout_path).strip()
return return_val
return wrapper
@set_config
def update(self, options, args, file_list):
"""Runs git to update or transparently checkout the working copy.

@ -393,6 +393,8 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
self.assertEqual(file_list, expected_file_list)
self.assertEqual(scm.revinfo(options, (), None),
'a7142dc9f0009350b96a11f372b6ea658592aa95')
self.assertEqual(scm._Capture(['config', '--get', 'diff.ignoreSubmodules']),
'all')
sys.stdout.close()
def testUpdateMerge(self):

Loading…
Cancel
Save