Commit 3da82907 authored by Uwe Scholz's avatar Uwe Scholz

Created git-scripts directory with git hooks inside, updated README.md

Removing stashing and unstashing in pre-push hook (which was pre-commit hook before)
parent 398ddd2d
......@@ -108,11 +108,13 @@ for detailed information regarding the installation of GNOME Commander.
### Tip for working with git ###
There exists a [pre-commit.sh](pre-commit.sh) script in the main
directory of the repository. Just type ``ln -s ../../pre-commit.sh
.git/hooks/pre-commit`` to activate this script. It runs ``make`` and
``make check`` before your change will be finally committed. This is
really nice for lazy people.
There exists a git-scripts directory with a [pre-commit](pre-commit)
and a [pre-push](pre-push) hook. Just type ``ln -s ../../pre-commit
.git/hooks/pre-commit`` and vice verso for the pre-push hook to
activate each hook.
Both scripts run simple checks before actually committing or pushing
your source code changes.
### Docker ###
......
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
#!/bin/sh
git stash -q --keep-index
make && make check
RESULT=$?
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment