From e9776958954ad20dc5b84aa129f1431ce0a31bb9 Mon Sep 17 00:00:00 2001 From: Cristian Klein Date: Tue, 8 Jan 2019 13:23:48 +0100 Subject: [PATCH] Better support for git submodule --- cpplint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpplint.py b/cpplint.py index bb03dfd..46b2bd2 100755 --- a/cpplint.py +++ b/cpplint.py @@ -1573,8 +1573,10 @@ def RepositoryName(self): # 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 + if os.path.exists(os.path.join(current_dir, ".git")): + root_dir = current_dir + break # stop here, we might be in a submodule + if (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)