mirror of
https://github.com/awsdocs/aws-doc-sdk-examples.git
synced 2026-03-26 06:22:18 +00:00
* 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.
31 lines
635 B
Bash
Executable File
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
|