Re: [PATCH] checkout: add --autostash option for branch switching
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Apr 14, 2026, 20:06 UTC
- Message-ID
- <20260414200640.50910-1-haraldnordgren@gmail.com>
- In-Reply-To
- <f012cc7e-14fa-40d2-84dc-7407fdceb36d@gmail.com>
> 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?
> > + autostash_msg.len ? autostash_msg.buf : NULL); > > Can we create an autostash without setting a message in autostash_msg?
No, seems not. I'll simplify it!
> > + if (created_autostash && !opts->discard_changes && !opts->quiet && > > Wouldn't it be a bug if we've created and autostash when > opts->discard_changes is set? Why do we need to check it?
I'll simplify it!
Show 6 quoted lines
> > + new_branch_info->commit) > > + show_local_changes(&new_branch_info->commit->object, > > + &opts->diff_options); > > So this is a change to the output when using "checkout -m"? If so it > might be better as a separate change.
Do you mean to drop if from my patchset, or just make it a separate commit within this series?
Harald