mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-30 21:31:47 +00:00
40 lines
925 B
Bash
Executable File
40 lines
925 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.5-0-g8adca9b
|
|
|
|
#shellcheck disable=SC1090
|
|
source "${0%/*}/dev.inc.sh"
|
|
|
|
# check for last commit date
|
|
if [ ! -f "${LASTCOMMIT}" ]; then
|
|
if ! touch -d "$(git log -1 --format=%cD)" "${LASTCOMMIT}"; then
|
|
printf "No previous commit found, use \"git add\" instead ... Abort\n"
|
|
exit
|
|
fi
|
|
fi
|
|
|
|
set +f
|
|
FILES="$(find ./* -newer "${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 .
|
|
|