Revert of Convert cpplint.py to work with nested git repositories. (patchset #1 id:1 of https://codereview.chromium.org/1897153003/ )
Reason for revert:
This breaks WebRTC presubmit on the buildbots (due to /b/build being a Git repo, which in turn contains the checkout). See https://bugs.chromium.org/p/webrtc/issues/detail?id=5818 for more details.
It seems it also broke other projects (rakuco's comment #15).
Original issue's description:
> 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
>
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=300085
TBR=iannucci@chromium.org,skym@chromium.org,sdefresne@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=598090
Review URL: https://codereview.chromium.org/1919483002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300119 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cpplint.py b/cpplint.py
index 4b067d4..27def38 100755
--- a/cpplint.py
+++ b/cpplint.py
@@ -1014,13 +1014,12 @@
# Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by
# searching up from the current path.
- 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)
+ 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)
if (os.path.exists(os.path.join(root_dir, ".git")) or
os.path.exists(os.path.join(root_dir, ".hg")) or