[lint] Fix get_files
The output from git commands need to be stripped or the script doesn't
work as intended
Change-Id: If1e814b7785f9174100869da01b3bfd767109c1f
diff --git a/tools/get_files.py b/tools/get_files.py
index 98275cf..0d7e3b8 100644
--- a/tools/get_files.py
+++ b/tools/get_files.py
@@ -58,14 +58,14 @@
def _get_diff_base():
try:
upstream = _run_command(
- 'git', 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '"@{u}"')
+ 'git', 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '"@{u}"').strip()
except subprocess.CalledProcessError:
upstream = 'origin/master'
local_commit = _run_command(
- 'git', 'rev-list', 'HEAD', '^' + upstream).split('\n')[-1]
+ 'git', 'rev-list', 'HEAD', '^' + upstream).strip().split('\n')[-1]
if not local_commit:
return 'HEAD'
- return _run_command('git', 'rev-parse', local_commit + '^')
+ return _run_command('git', 'rev-parse', local_commit + '^').strip()
# Get the source files that have been modified in this branch. By default this
@@ -73,7 +73,7 @@
# against HEAD if no such commit is found).
def _get_git_files():
diff_base = _get_diff_base()
- return _run_command('git', 'diff', '--name-only', diff_base).split('\n')
+ return _run_command('git', 'diff', '--name-only', diff_base).strip().split('\n')
def files_to_lint(extensions, only_directories=[], all_files=False):