2019-04-25 12:45:16 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# file: git-add.sh
|
|
|
|
#
|
2019-04-25 13:17:35 +00:00
|
|
|
# works together with git pre-push.sh and ADD all changed files since last push
|
2019-04-25 12:45:16 +00:00
|
|
|
|
2019-04-25 14:59:17 +00:00
|
|
|
#### $$VERSION$$ v0.70-dev3-4-g8f4b168
|
2019-04-25 12:45:16 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
FILES="$(find ./* -newer .git/.lastpush)"
|
|
|
|
[ "${FILES}" = "" ] && echo "Noting changed since last push!" && 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: "
|
2019-04-25 12:45:16 +00:00
|
|
|
# shellcheck disable=SC2086
|
2019-04-25 13:39:42 +00:00
|
|
|
for file in ${FILES}
|
|
|
|
do
|
|
|
|
[ -d "${file}" ] && continue
|
|
|
|
git add "${file}" && echo -n "${file} "
|
|
|
|
done
|
|
|
|
echo "done."
|
2019-04-25 12:45:16 +00:00
|
|
|
|