dev: save date of last commit

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-19 18:09:45 +01:00
parent 427f670a02
commit b0f653b705
3 changed files with 13 additions and 7 deletions

View File

@ -5,7 +5,7 @@
# #
# Description: common stuff for all dev scripts # Description: common stuff for all dev scripts
# #
#### $$VERSION$$ v1.30-0-g3266427 #### $$VERSION$$ v1.31-dev-2-g427f670
############################################################# #############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
@ -20,3 +20,5 @@ else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
HOOKDIR="dev/hooks"
LASTCOMMIT=".git/.lastcommit"

View File

@ -3,15 +3,21 @@
# #
# works together with git pre-push.sh and ADD all changed files since last push # works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v1.30-0-g3266427 #### $$VERSION$$ v1.31-dev-2-g427f670
#shellcheck disable=SC1090 #shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh" source "${0%/*}/dev.inc.sh"
[ ! -f .git/.lastcommit ] && printf "No previous commit or hooks not installed, use \"git add\" instead ... Abort\n" && exit # 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 set +f
FILES="$(find ./* -newer .git/.lastcommit| grep -v -e 'DIST\/' -e 'STANDALONE\/' -e 'JSON.sh')" FILES="$(find ./* -newer "${LASTCOMMIT}" | grep -v -e 'DIST\/' -e 'STANDALONE\/' -e 'JSON.sh')"
set -f set -f
# FILES="$(find ./* -newer .git/.lastpush)" # FILES="$(find ./* -newer .git/.lastpush)"
[ "${FILES}" = "" ] && printf "Nothing changed since last commit ...\n" && exit [ "${FILES}" = "" ] && printf "Nothing changed since last commit ...\n" && exit

View File

@ -1,13 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# this has to run once atfer git clone # this has to run once atfer git clone
# and every time we create new hooks # and every time we create new hooks
#### $$VERSION$$ v1.30-0-g3266427 #### $$VERSION$$ v1.31-dev-2-g427f670
#shellcheck disable=SC1090 #shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh" source "${0%/*}/dev.inc.sh"
HOOKDIR="dev/hooks"
printf "Installing hooks..." printf "Installing hooks..."
for hook in pre-commit post-commit pre-push for hook in pre-commit post-commit pre-push
do do