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

Re: pre-commit hook not run on conflict resolution during rebase

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2015, 20:03 UTC
Message-ID
<xmqqy4k8fp1g.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1m55i3m.1fum4zo1fpnhncM%lists@haller-berlin.de>
lists@haller-berlin.de (Stefan Haller) writes:
Show 5 quoted lines
> When a rebase stops because of a conflict, and I edit the file to
> resolve the conflict and say "git rebase --continue", then the
> pre-commit hook doesn't run at that point,...
> From glancing through the githooks manpage, I couldn't see any other
> hook that would help in this situation. Am I missing something?

I do not think so. There may be some fallouts, like negatively affecting folks who have been relying on the current behaviour, but I do not see a fundamental reason why that hook should not trigger there (it may not trigger in the current implementation, but I view it as lack of need so far, not a deliberate omission).

> I guess the next best solution would be to also have a pre-push hook
> that performs the same checks again, just in case the bad code managed
> to get past the pre-commit hook for some reason or other. This feels
> very redundant, but I guess it would work well.

I'd say pre-receive would be the most sensible place to check things like this. Some of your developers may not have pre-commit hook or even run "commit --no-verify" to bypass the local check, and if you have a central meeting place for the efforts by all your folks, that is where you want to enforce the policy.

Checks done anywhere else are what are redundant, including the pre-commit hook in individual developers. You can view them as a way for individual developers to save their time---by choosing to check locally, they make sure their commits do not trigger the pre-receive hook at the central place.

Previous: Stefan HallerNext: Stefan Haller
Message 2 of 3 in “pre-commit hook not run on conflict resolution during rebase”
  1. Stefan HallerMay 28, 2015
  2. Junio C HamanoMay 28, 2015
  3. Stefan HallerMay 29, 2015

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.