Files
Corey Pyle 50b7b4c27f JavaScript (v3): Fixing ESLint errors. (#6385)
* JavaScript (v3): Task - Update main readme with linting instructions.
* JavaScript (v3): Task - Fix bug in pre-commit.
* JavaScript (v3): Task - Remove test script from external lib.
* JavaScript (v3): Add transcribe to npm workspace.
2024-04-30 13:36:13 -07:00

31 lines
635 B
Bash
Executable File

#!/bin/sh
set -e
tag="[PRE-COMMIT]"
log() {
echo "$tag $1"
}
# If any of the local directories contain staged changes, try
# and run pre-commit.sh.
for dir in * ; do
if [ -d "$dir" ]; then
# Get a list of file names for changed files.
staged=$(git diff --cached --name-only -- "$dir")
if [ -n "$staged" ] ; then
log "The following files have staged changes in $dir:"
log "$staged"
if [ -x "${dir}/hook_scripts/pre-commit.sh" ] ; then
# Enter directory.
(cd "$dir" || exit
log "Working from $(pwd)..."
./hook_scripts/pre-commit.sh)
fi
fi
fi
done