telegram-bot-bash/dev/git-add.sh
Kay Marquardt (Gnadelwartz) 550a0defb3 dev: use dev.inc.sh
2021-01-15 14:23:19 +01:00

34 lines
840 B
Bash
Executable File

#!/usr/bin/env bash
# file: git-add.sh
#
# works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v1.30-dev-20-g541a279
#shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh"
[ ! -f .git/.lastcommit ] && printf "No previous commit or hooks not installed, use \"git add\" instead ... Abort\n" && exit
set +f
FILES="$(find ./* -newer .git/.lastcommit| grep -v -e 'DIST\/' -e 'STANDALONE\/' -e 'JSON.sh')"
set -f
# FILES="$(find ./* -newer .git/.lastpush)"
[ "${FILES}" = "" ] && printf "Nothing changed since last commit ...\n" && exit
# run pre_commit on files
dev/hooks/pre-commit.sh
printf "Add files to repo: "
# shellcheck disable=SC2086
for file in ${FILES}
do
[ -d "${file}" ] && continue
printf "%s" "${file} "
done
printf " - Done.\n"
# stay with "." for (re)moved files!
git add .