telegram-bot-bash/dev/git-add.sh

31 lines
789 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# file: git-add.sh
#
# works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v0.72-dev-0-g6afa177
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir)
cd "$GIT_DIR/.." || exit 1
2019-05-02 13:14:18 +00:00
[ ! -f .git/.lastpush ] && echo "No push or hooks not installed, use \"git add\" instead ... Abort" && exit
2019-05-01 10:15:10 +00:00
FILES="$(find ./* -newer .git/.lastpush)"
2019-05-01 10:15:10 +00:00
[ "${FILES}" = "" ] && echo "Noting changed since last push ... Abort" && exit
2019-04-25 13:39:42 +00:00
# run pre_commit on files
dev/hooks/pre-commit.sh
echo -n "Add files to repo: "
# shellcheck disable=SC2086
2019-04-25 13:39:42 +00:00
for file in ${FILES}
do
[ -d "${file}" ] && continue
2019-04-26 09:28:51 +00:00
echo -n "${file} "
2019-04-25 13:39:42 +00:00
done
2019-04-26 09:28:51 +00:00
git add .
2019-04-25 13:39:42 +00:00
echo "done."