possible problem in .pre-commit.sh
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
It looks like there might be a problem in .pre-commit.sh:
TXT_FILES=`git diff --cached --name-only | grep -E $TXT_FILE_PATTERN`
TXT_FILES="$TXT_FILES"`git diff --cached --name-only | grep -E ^doc/`
I guess the last line from original $TXT_FILES would be joined with the first line from appended git diff ...:
$ (T=`echo a; echo b`; T="$T"`echo c`; printf '%s\n' "$T")
a
bc
Fix might use $'\n' but it would not work on dash. OTOH there is grep -lU $'\x0D' already. So shebang should be changed to /bin/bash anyway.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect .pre-commit.sh and reproduce the staged filename handling with files matching the text pattern and files under doc/. Check the hook under the shells it is intended to support, including dash and bash. Done means the collected filenames remain correctly separated and the pre-commit check works without shell-specific breakage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, shell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100