mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-10 12:46:16 +00:00
66cf3b3aba
Summary: By using Git’s magic pathspecs instead of post-processing stream operations, we reduce the pipeline to a single operation. Git implements its own version of `grep`, so this should be platform-independent. Previously, we had needed the `-z` argument to `grep(1)`, which is a GNU extension. Fixes #594. Test Plan: Ensure that the script passes with no output. Then, ```shell mkdir -p src/flow-typed/ touch src/foo.js src/flow-typed.js src/flow-typed/foo.js git add src/foo.js src/flow-typed.js src/flow-typed/foo.js cd scripts ./ensure-flow.js ``` and ensure that script exits with code 1, empty stdout, and stderr with: ``` ../src/flow-typed.js ../src/flow-typed/foo.js ../src/foo.js ``` This verifies that the pathspec is properly excluding the root directory `flow-typed`, but not files that just happen to have `flow-typed` in their paths. wchargin-branch: simplify-ensure-flow
5 lines
122 B
Bash
Executable File
5 lines
122 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
! git grep -F --files-without-match -e '@flow' -e '@no-flow' \
|
|
-- ':/*.js' ':!/flow-typed/' >&2
|