Convert cpplint.py to work with nested git repositories.

Chrome on iOS downstream repository tracks Chromium via DEPS and wants
to use cpplint canned presubmit check but the cpplint.py errors due at
the include guard as it stops at the inner most git repository.

Change cpplint.py to look for the outermost git repository when looking
for the repository root.

BUG=598090

Review URL: https://codereview.chromium.org/1897153003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300085 0039d316-1c4b-4281-b951-d872f2087c98
parent f6b2eb69
......@@ -1014,12 +1014,13 @@ class FileInfo(object):
# Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by
# searching up from the current path.
root_dir = os.path.dirname(fullname)
while (root_dir != os.path.dirname(root_dir) and
not os.path.exists(os.path.join(root_dir, ".git")) and
not os.path.exists(os.path.join(root_dir, ".hg")) and
not os.path.exists(os.path.join(root_dir, ".svn"))):
root_dir = os.path.dirname(root_dir)
root_dir = current_dir = os.path.dirname(fullname)
while current_dir != os.path.dirname(current_dir):
if (os.path.exists(os.path.join(current_dir, ".git")) or
os.path.exists(os.path.join(current_dir, ".hg")) or
os.path.exists(os.path.join(current_dir, ".svn"))):
root_dir = current_dir
current_dir = os.path.dirname(current_dir)
if (os.path.exists(os.path.join(root_dir, ".git")) or
os.path.exists(os.path.join(root_dir, ".hg")) or
......
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