aboutsummaryrefslogtreecommitdiffhomepage
path: root/build_tools
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-08 12:08:23 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-08 12:08:23 -0700
commit0d1d324e9f6719a5d4198ee0e8efd05cad89fc39 (patch)
tree093b8c661db882cb0e26e055e4799c242c428035 /build_tools
parent100eef4e426402ebde1040dbfab8ded5a20854d1 (diff)
only deal with files that exist
I noticed while working on an unrelated change that deleting a file caused `make lint` to behave in an unexpected manner.
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/lint.fish7
-rwxr-xr-xbuild_tools/style.fish7
2 files changed, 10 insertions, 4 deletions
diff --git a/build_tools/lint.fish b/build_tools/lint.fish
index 5ac05d7d..f40d4c35 100755
--- a/build_tools/lint.fish
+++ b/build_tools/lint.fish
@@ -54,8 +54,11 @@ else
set files (git show --word-diff=porcelain --name-only --pretty=oneline)[2..-1]
end
- # Extract just the C/C++ files.
- set c_files (string match -r '.*\.c(?:pp)?$' -- $files)
+ # Extract just the C/C++ files that exist.
+ set c_files
+ for file in (string match -r '.*\.c(?:pp)?$' -- $files)
+ test -f $file; and set c_files $c_files $file
+ end
end
# We now have a list of files to check so run the linters.
diff --git a/build_tools/style.fish b/build_tools/style.fish
index ee54216b..b5b3b871 100755
--- a/build_tools/style.fish
+++ b/build_tools/style.fish
@@ -42,8 +42,11 @@ else
set files (git show --name-only --pretty=oneline | tail --lines=+2)
end
- # Extract just the C/C++ files.
- set c_files (string match -r '^.*\.(?:c|cpp|h)$' -- $files)
+ # Extract just the C/C++ files that exist.
+ set c_files
+ for file in (string match -r '^.*\.(?:c|cpp|h)$' -- $files)
+ test -f $file; and set c_files $c_files $file
+ end
# Extract just the fish files.
set f_files (string match -r '^.*\.fish$' -- $files)
end