aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild_tools/lint.fish5
-rwxr-xr-xbuild_tools/style.fish5
2 files changed, 6 insertions, 4 deletions
diff --git a/build_tools/lint.fish b/build_tools/lint.fish
index f40d4c35..2b21402c 100755
--- a/build_tools/lint.fish
+++ b/build_tools/lint.fish
@@ -48,10 +48,11 @@ if test $all = yes
else
# We haven't been asked to lint all the source. If there are uncommitted
# changes lint those, else lint the files in the most recent commit.
- set files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
+ # Select (cached files) (modified but not cached, and untracked files)
+ set files (git diff-index --cached HEAD --name-only) (git ls-files --exclude-standard --others --modified)
if not set -q files[1]
# No pending changes so lint the files in the most recent commit.
- set files (git show --word-diff=porcelain --name-only --pretty=oneline)[2..-1]
+ set files (git diff-tree --no-commit-id --name-only -r HEAD)
end
# Extract just the C/C++ files that exist.
diff --git a/build_tools/style.fish b/build_tools/style.fish
index b5b3b871..27f89804 100755
--- a/build_tools/style.fish
+++ b/build_tools/style.fish
@@ -34,12 +34,13 @@ if test $all = yes
else
# We haven't been asked to reformat all the source. If there are uncommitted changes reformat
# those using `git clang-format`. Else reformat the files in the most recent commit.
- set files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
+ # Select (cached files) (modified but not cached, and untracked files)
+ set files (git diff-index --cached HEAD --name-only) (git ls-files --exclude-standard --others --modified)
if set -q files[1]
set git_clang_format yes
else
# No pending changes so lint the files in the most recent commit.
- set files (git show --name-only --pretty=oneline | tail --lines=+2)
+ set files (git diff-tree --no-commit-id --name-only -r HEAD)
end
# Extract just the C/C++ files that exist.