From 1988c6876d6cbdeda933dafbd808f59ce04e1033 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 19 Sep 2018 08:40:57 -0500 Subject: [PATCH 1/2] refactor: use same diff args as run-clang-format --- script/lint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lint.js b/script/lint.js index bf5446737133..966c0146a44a 100755 --- a/script/lint.js +++ b/script/lint.js @@ -98,7 +98,7 @@ function parseCommandLine () { } async function findChangedFiles (top) { - const result = await GitProcess.exec(['diff', 'HEAD', '--name-only'], top) + const result = await GitProcess.exec(['diff', '--name-only', '--cached'], top) if (result.exitCode !== 0) { console.log('Failed to find changed files', GitProcess.parseError(result.stderr)) process.exit(1) From 03553abc11a63ca025873681b3bfad57c4fdcd2a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 19 Sep 2018 08:42:03 -0500 Subject: [PATCH 2/2] feat: use run-clang-format in cc --fix mode --- script/lint.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/lint.js b/script/lint.js index 966c0146a44a..76d6cede614b 100755 --- a/script/lint.js +++ b/script/lint.js @@ -59,7 +59,10 @@ const LINTERS = [ { } } } - if (result.status) process.exit(result.status) + if (result.status) { + if (opts.fix) spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames]) + process.exit(result.status) + } } }, { key: 'python',