Re: [PATCH] hooks/pre-commit: add example to add Signed-off-by line to message
- From
- Andy Parkins <andyparkins@gmail.com>
- Date
- Dec 20, 2006, 15:54 UTC
- Message-ID
- <200612201554.52553.andyparkins@gmail.com>
- In-Reply-To
- <Pine.LNX.4.63.0611291219190.30004@wbgn013.biozentrum.uni-wuerzburg.de>
On Wednesday 2006 November 29 11:20, Johannes Schindelin wrote:
> +# . git-sh-setup > +# git var GIT_AUTHOR_IDENT | \ > +# sed -n "s/^\(.*\) [0-9]\+ [-+][0-9]\+$/Signed-off-by: \1/p" \ > +# > $GIT_DIR/SQUASH_MSG
I've been using this; and very useful it is too. However, I just noticed that I was getting "Not a git repository" errors when I tried to commit in a subdirectory. I traced the problem to my use of this fragment. It seems that calling git-sh-setup inside the pre-commit hook was changing GIT_DIR (don't know why). When I changed this to
git var GIT_AUTHOR_IDENT | \ sed -n "s/^\(.*\) [0-9]\+ [-+][0-9]\+$/Signed-off-by: \1/p" \ >> $(git-rev-parse --git-dir)/SQUASH_MSG
It worked correctly again.
Andy
-- Dr Andy Parkins, M Eng (hons), MIEE