From: rsbecker@nexbridge.com Date: Wed, 22 Oct 2025 14:27:01 GMT Subject: RE: [BUG] Strange git notes completion behaviour Message-ID: <018701dc435f$f1dc1a00$d5944e00$@nexbridge.com> In-Reply-To: <20251022092708.GE853931@coredump.intra.peff.net> On October 22, 2025 5:27 AM, Jeff King wrote: >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. I tried running with --no-pager. No difference. Interesting: git show $(git notes list HEAD) works correctly with no error report (from inside gdb), while the run of git --no-pager notes show HEAD still reports: Run till exit from #0 main (argc=5, argv=0x811d000) at /home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/common-main.c:8 Process (0,896) exited with code 037777777764. Is there a path where just an implied return is used? I have seen the optimizer return whatever is in an x86 register - rsx and rsi are both 12 at git.c:982 - on occasion.