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

Re: git checkout exit value and post-commit hooks

From
APAndreas Politz <politza@hochschule-trier.de>
Date
Mar 14, 2017, 10:07 UTC
Message-ID
<87tw6w9nnq.fsf@luca>
In-Reply-To
<xmqqshmgjt2j.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> Andreas Politz <politza@hochschule-trier.de> writes:
>
>> the exit value of a `git checkout' seems to depend on the exit values of
>> the hooks it runs. This breaks for example `git bisect', as seen in the
>> following example.
>
> I am a bit puzzled why you have "checkout" and "post-commit" on the
> title, though.  Does checkout call a hook for "commit"?
No, just a typo.
> Any script that calls "git checkout" and sees it fail should not
> blindly continue its usual processing; if "git bisect" notices an
> error from "git checkout" it internally runs and stops, it is doing
> the right thing.
So its by designed, I should have guessed as much.

I'm sorry, I never used git-hooks before and spend an hour trying to figure out, why I can't reset the bisect operation, while the error message (something to the effect of "Unable to checkout master" seemed ridiculous.

-ap
Previous: Junio C Hamano
Message 3 of 3 in “git checkout exit value and post-commit hooks”
  1. Andreas PolitzMar 14, 2017
  2. Junio C HamanoMar 14, 2017
  3. Andreas PolitzMar 14, 2017

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.