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

Re: [PATCH] sample pre-commit hook: don't trigger when recording a merge

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
Jan 17, 2010, 21:16 UTC
Message-ID
<20100118061636.6117@nanako3.lavabit.com>
In-Reply-To
<20100109081652.6117@nanako3.lavabit.com>
Hi,

I sent this patch but didn't receive any feedback. Is it a bad idea? It may be better if 'git-commit' didn't call this hook when recording a merge, but I don't write C very much.

Thanks.
Show 32 quoted lines
> When recording a merge, even if there are problematic whitespace errors,
> let them pass, because the damage has already been done in the history. If
> this hook triggers, it will invite a novice to fix such errors in a merge
> commit but such a change is not related to the merge. Don't encourage it.
>
> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
> ---
>  templates/hooks--pre-commit.sample |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
> index 439eefd..66e56bb 100755
> --- a/templates/hooks--pre-commit.sample
> +++ b/templates/hooks--pre-commit.sample
> @@ -7,6 +7,11 @@
>  #
>  # To enable this hook, rename this file to "pre-commit".
>  
> +if test -f "${GIT_DIR-.git}"/MERGE_HEAD
> +then
> +	exit 0
> +fi
> +
>  if git-rev-parse --verify HEAD >/dev/null 2>&1
>  then
>  	against=HEAD
> -- 
> 1.6.6
>
> -- 
> Nanako Shiraishi
> http://ivory.ap.teacup.com/nanako3/
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Nanako ShiraishiNext: Junio C Hamano
Message 2 of 3 in “sample pre-commit hook: don't trigger when recording a merge”
  1. sample pre-commit hook: don't trigger when recording a mergeNanako Shiraishi, Jan 8, 2010
  2. Nanako ShiraishiJan 17, 2010
  3. Junio C HamanoJan 17, 2010

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.