[gnome-commander/get_rid_of_xml] Created git-scripts directory with git hooks inside, updated README.md
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/get_rid_of_xml] Created git-scripts directory with git hooks inside, updated README.md
- Date: Wed, 26 Sep 2018 07:50:09 +0000 (UTC)
commit 3da829076d474f607aa7d64ebec017df49813220
Author: Uwe Scholz <u scholz83 gmx de>
Date: Wed Sep 26 09:30:21 2018 +0200
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)
README.md | 12 +++++++-----
git-scripts/pre-commit | 25 +++++++++++++++++++++++++
pre-commit.sh => git-scripts/pre-push | 4 ----
3 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/README.md b/README.md
index 4cebaf78..ae4b5a80 100644
--- a/README.md
+++ b/README.md
@@ -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 ###
diff --git a/git-scripts/pre-commit b/git-scripts/pre-commit
new file mode 100755
index 00000000..59b2114e
--- /dev/null
+++ b/git-scripts/pre-commit
@@ -0,0 +1,25 @@
+#!/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 --
diff --git a/pre-commit.sh b/git-scripts/pre-push
similarity index 63%
rename from pre-commit.sh
rename to git-scripts/pre-push
index db1490fd..40e31d40 100755
--- a/pre-commit.sh
+++ b/git-scripts/pre-push
@@ -1,13 +1,9 @@
#!/bin/sh
-git stash -q --keep-index
-
make && make check
RESULT=$?
-git stash pop -q
-
[ $RESULT -ne 0 ] && exit 1
exit 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]