Files
coder/scripts/check_unstaged.sh
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
537 B
Bash
Raw Normal View History

2022-01-08 11:24:02 -06:00
#!/bin/bash
set -euo pipefail
2022-09-08 02:40:17 +10:00
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
cdroot
2022-01-08 11:24:02 -06:00
2022-09-08 02:40:17 +10:00
FILES="$(git ls-files --other --modified --exclude-standard)"
if [[ "$FILES" != "" ]]; then
mapfile -t files <<<"$FILES"
2022-01-08 11:24:02 -06:00
2022-09-08 02:40:17 +10:00
log
log "The following files contain unstaged changes:"
log
for file in "${files[@]}"; do
log " - $file"
done
2022-01-08 11:24:02 -06:00
2022-09-08 02:40:17 +10:00
log
log "These are the changes:"
log
for file in "${files[@]}"; do
git --no-pager diff -- "$file" 1>&2
2022-09-08 02:40:17 +10:00
done
2022-01-08 11:24:02 -06:00
2022-09-08 02:40:17 +10:00
log
error "Unstaged changes, see above for details."
fi