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

Re: [PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 25, 2006, 00:20 UTC
Message-ID
<20060825002013.GG2817@diku.dk>
In-Reply-To
<8764giro6t.fsf@rho.meyering.net>
Jim Meyering <jim@meyering.net> wrote Thu, Aug 24, 2006:
Show 5 quoted lines
> I tried cg-commit with a commit hook, but the hook never ran.
> The problem was a typo:
> 
> Fix a typo that would inhibit running the post-commit script:
> s/commit-post/post-commit/.

If I remember correctly, historically, the commit-post existed before the post-commit appeared. You can see that it is documented in the man page so it is not a typo.

However, this should certainly be updated, but I think a better fix would be to transitionally warn the user about the existence of the commit-post hook before using it in favour of post-commit.

Show 23 quoted lines
> diff --git a/cg-commit b/cg-commit
> index 9d3b1a1..82eea60 100755
> --- a/cg-commit
> +++ b/cg-commit
> @@ -604,15 +604,16 @@ if [ "$newhead" ]; then
>  		branchname="$(cat "$_git/branch-name")"
>  	fi
>  	[ -z "$branchname" ] && [ "$_git_head" != "master" ] && branchname="$_git_head"
> -	if [ -x "$_git/hooks/post-commit" -a ! "$no_hooks" ]; then
> +	post_commit="$_git/hooks/post-commit"
> +	if [ -x "$post_commit" -a ! "$no_hooks" ]; then
>  		if [ "$(git-repo-config --bool cogito.hooks.commit.post.allmerged)" = "true" ]; then
>  			# We just hope that for the initial commit, the user didn't
>  			# manage to install the hook yet.
>  			for merged in $(git-rev-list $newhead ^$oldhead | tac); do
> -				"$_git/hooks/post-commit" "$merged" "$branchname"
> +				"$post_commit" "$merged" "$branchname"
>  			done
>  		else
> -			"$_git/hooks/post-commit" "$newhead" "$branchname"
> +			"$post_commit" "$newhead" "$branchname"
>  		fi
>  	fi

The patch looks more like a refactoring of a previous commit that did the commit-post -> post-commit replacement.

-- 
Jonas Fonseca
Previous: Jim MeyeringNext: Jim Meyering
Message 2 of 4 in “cg-commit: Fix a typo that would inhibit running of post-commit script:”
  1. cg-commit: Fix a typo that would inhibit running of post-commit script:Jim Meyering, Aug 24, 2006
  2. Jonas FonsecaAug 25, 2006
  3. Jim MeyeringSep 16, 2006
  4. Petr BaudisSep 24, 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.