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

Re: [BUG] Strange git notes completion behaviour

From
Jeff King <peff@peff.net>
Date
Oct 22, 2025, 09:27 UTC
Message-ID
<20251022092708.GE853931@coredump.intra.peff.net>
In-Reply-To
<013201dc42d5$07a71550$16f53ff0$@nexbridge.com>
On Tue, Oct 21, 2025 at 05:52:38PM -0400, rsbecker@nexbridge.com wrote:
> It is the exit code. When in gdb, the return from notes is -12 as above. By the time
> It gets back to bash, the lower bytes are dropped so I end up with a 0xFF, which
> bash thinks is a 0, so the exit code is hidden from view. I tried the !!fn construct
> in a standard alone test program with no wisdom gained.

I don't think the "!!fn()" line ever returns here. In the show() function of builtin/notes.c (which is what "fn" is pointing to for "git notes show"), we end up calling execv_git_cmd() to run "git show". So you are really seeing the exit code of something like:

  git show $(git notes list HEAD)

That in turn is propagating the return from show_blob_object(). Which I'd think would return "0" here, since it actually showed the blob, though it does look like it could return -1 in a few cases.

Another possible point of confusion: that git-show invocation will run a pager. It's been a long time since I've looked at that code, but IIRC we try to preserve the exit code of the actual Git command (rather than the pager). But you might try:

  git --no-pager notes show HEAD

to see if that behaves differently. I couldn't reproduce the issue at all on my end.

-Peff
Previous: rsbecker@nexbridge.comNext: rsbecker@nexbridge.com
Message 4 of 12 in “[BUG] Strange git notes completion behaviour”
  1. rsbecker@nexbridge.comOct 21, 2025
  2. D. Ben KnobleOct 21, 2025
  3. rsbecker@nexbridge.comOct 21, 2025
  4. Jeff KingOct 22, 2025
  5. rsbecker@nexbridge.comOct 22, 2025
  6. Jeff KingOct 23, 2025
  7. rsbecker@nexbridge.comOct 24, 2025
  8. Jeff KingOct 24, 2025
  9. rsbecker@nexbridge.comOct 24, 2025
  10. Jeff KingOct 24, 2025
  11. rsbecker@nexbridge.comOct 24, 2025
  12. Jeff KingOct 24, 2025

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.