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)