git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] hooks/pre-commit: add example to add Signed-off-by line to message

From
APAndy 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
Previous: Johannes SchindelinNext: Andy Parkins
Message 2 of 11 in “hooks/pre-commit: add example to add Signed-off-by line to message”
  1. hooks/pre-commit: add example to add Signed-off-by line to messageJohannes Schindelin, Nov 29, 2006
  2. Andy ParkinsDec 20, 2006
  3. hooks/pre-commit: add example to add Signed-off-by line to messageAndy Parkins, Dec 20, 2006
  4. Johannes SchindelinDec 20, 2006
  5. Junio C HamanoDec 20, 2006
  6. Johannes SchindelinDec 20, 2006
  7. Junio C HamanoDec 20, 2006
  8. Johannes SchindelinDec 21, 2006
  9. hooks/commit-msg: add example to add Signed-off-by line to messageAndy Parkins, Dec 21, 2006
  10. Junio C HamanoDec 22, 2006
  11. Andy ParkinsDec 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.