[PATCH for comments] configure: install a whitespace checking pre-commit hook for developers
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Tue Apr 10 22:41:20 UTC 2018
hi Ralph,
On 11/04/18 00:45, Ralph Böhme via samba-technical wrote:
> diff --git a/script/git-hooks/pre-commit-hook b/script/git-hooks/pre-commit-hook
> new file mode 100755
> index 00000000000..223a30dc53d
> --- /dev/null
> +++ b/script/git-hooks/pre-commit-hook
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +
> +gitdir=$(git rev-parse --show-toplevel)
If the above fails for some reason, then the next line will be calling
/script/git-hooks/pre-commit-script ...
> +${gitdir}/script/git-hooks/pre-commit-script || exit $?
> +
> +exit 0
> diff --git a/script/git-hooks/pre-commit-script b/script/git-hooks/pre-commit-script
> new file mode 100755
> index 00000000000..eb4114e197d
> --- /dev/null
> +++ b/script/git-hooks/pre-commit-script
> @@ -0,0 +1,9 @@
> +#!/bin/sh
so we'll never got to here:
> +gitdir=$(git rev-parse --show-toplevel)
> +if [ $? -ne 0 ] ; then
> + echo "git rev-parse --show-toplevel failed"
> + exit 1
> +fi
therefore I think we need the rev-parse failure check in
pre-commit-hook. (or a `set -e` for the same effect).
Otherwise good.
Douglas
More information about the samba-technical
mailing list