aboutsummaryrefslogtreecommitdiffhomepage
path: root/build_tools
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2016-05-18 23:00:30 +0000
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2016-05-18 23:00:30 +0000
commit21fc2decd741d3a18c88445e11de8860148060d0 (patch)
treeb00f0c88c84c28dc0db92aa5ccd52b568cebd615 /build_tools
parent9192bf1db5b8287a507d7a479a69a2560aae260a (diff)
lint, style: use git plumbing commands
Rather than using porcelain commands, try using plumbing for a more stable interface with less string munging.
Diffstat (limited to 'build_tools')
-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.