diff --git a/dev/dev.inc.sh b/dev/dev.inc.sh index fa0fd75..7a52c72 100644 --- a/dev/dev.inc.sh +++ b/dev/dev.inc.sh @@ -5,7 +5,7 @@ # # 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, @@ -20,3 +20,5 @@ else printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 fi +HOOKDIR="dev/hooks" +LASTCOMMIT=".git/.lastcommit" diff --git a/dev/git-add.sh b/dev/git-add.sh index 39c94eb..1e38538 100755 --- a/dev/git-add.sh +++ b/dev/git-add.sh @@ -3,15 +3,21 @@ # # 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 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 -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 # FILES="$(find ./* -newer .git/.lastpush)" [ "${FILES}" = "" ] && printf "Nothing changed since last commit ...\n" && exit diff --git a/dev/install-hooks.sh b/dev/install-hooks.sh index e4e41b4..298c0cd 100755 --- a/dev/install-hooks.sh +++ b/dev/install-hooks.sh @@ -1,13 +1,11 @@ #!/usr/bin/env bash # this has to run once atfer git clone # and every time we create new hooks -#### $$VERSION$$ v1.30-0-g3266427 +#### $$VERSION$$ v1.31-dev-2-g427f670 #shellcheck disable=SC1090 source "${0%/*}/dev.inc.sh" -HOOKDIR="dev/hooks" - printf "Installing hooks..." for hook in pre-commit post-commit pre-push do