From: Phillip Wood Date: Wed, 15 Apr 2026 09:35:13 GMT Subject: Re: [PATCH] checkout: add --autostash option for branch switching Message-ID: In-Reply-To: <20260414200640.50910-1-haraldnordgren@gmail.com> On 14/04/2026 21:06, Harald Nordgren wrote: >> The changes up to here look like fixes for an existing bug and so would >> be better in a separate patch. > > 👍 > >> Sometimes we return "1" and sometimes "-1" what does that signal to the >> caller? > > I just tried to follow a pattern, I'm not knowlegable of how this return > code will be used. Futher down in the file we check 'ret == -1' and > turn it into 1, so maybe 1 is correct? But you can read the code to see how it is used. Tracing the return path of merge_working_tree(), the return value get propagated back up to the top of the call stack i.e. cmd_checkout() or cmd_switch() and used as the return value there. I had wondered if we were using the value on the way back up the stack and doing something different based on the whether it was "1" or "-1" but we don't so it only affects the exit code of "git checkout". That means returning "1" is sensible I think. > Do you mean to drop if from my patchset, or just make it a separate > commit within this series? A separate commit in this series. As "git checkout" without "-m" can also carry local changes across we probably should do the same there as well. Thanks Phillip