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

Re: [PATCH] RFC: switch: allow same-commit switch during merge if conflicts resolved

From
Tao Klerks <tao@klerks.biz>
Date
May 5, 2023, 05:06 UTC
Message-ID
<CAPMMpoi7+rdQzQPyVB8T9Pb+f332c68QvWLkwBdJZw=BcP0jbQ@mail.gmail.com>
In-Reply-To
<CAPMMpogiTVksUKgZ==n4d3xm4ZJqxm7ki2dOF8j8S5BaJvu1Ew@mail.gmail.com>
On Thu, May 4, 2023 at 7:01 AM Tao Klerks <tao@klerks.biz> wrote:
Show 5 quoted lines
>
> Please let me know whether you would be comfortable with a patch that:
> * Fixed checkout to be more restrictive (except still allowing --force
> at least on a merging state)
> [...]
Having reviewed the commit by Nguyễn Thái Ngọc Duy that introduced the
"can_switch_when_in_progress" boolean in 2019 (as part of the broader
introduction of "git switch" and "git restore"), it looks like I
should change my proposal here. I thought it made sense to continue to
support --force because we can, but I now think this is wrong,
because:
1. the fact that --force does not work in git switch is *intentional*
2. even though making it work for "merging" states would be trivial,
making it work during rebase would not be
3. the blocking of --force is not a significant inconvenience, as the
error message clearly tells you what to do (--quit), to continue on
your way

So I will set about trying to understand how to make this one-line change work. I already see that some tests rely on "git checkout -f" bulldozing through an ongoing merge, so those tests will need to be adjusted at least.

Are there any recommendations or processes around breaking changes for the git project anywhere? The specific behaviors that we would be changing here appear to be undocumented (I've looked through https://git-scm.com/docs/git-checkout at least and find no mention or expectation that switching during a merge, or rebase, etc is supported; nor do I see any explicit mention in https://git-scm.com/docs/git-switch that it is UNsupported)

ASIDE: I realized today that the warnings in
die_if_some_operation_in_progress() suggest "--quit" (potentially
leaving a conflicted index) and do not mention "--abort". Is there any
objection to beefing up these messages a bit to offer both options?
Previous: Tao KlerksNext: Elijah Newren
Message 6 of 17 in “RFC: switch: allow same-commit switch during merge if conflicts resolved”
  1. RFC: switch: allow same-commit switch during merge if conflicts resolvedTao Klerks via GitGitGadget, May 2, 2023
  2. Elijah NewrenMay 2, 2023
  3. Junio C HamanoMay 2, 2023
  4. Elijah NewrenMay 3, 2023
  5. Tao KlerksMay 4, 2023
  6. Tao KlerksMay 5, 2023
  7. Elijah NewrenMay 7, 2023
  8. Elijah NewrenMay 7, 2023
  9. Felipe ContrerasMay 7, 2023
  10. Tao KlerksMay 8, 2023
  11. Felipe ContrerasMay 8, 2023
  12. Tao KlerksMay 8, 2023
  13. Junio C HamanoMay 8, 2023
  14. Felipe ContrerasMay 9, 2023
  15. Tao KlerksMay 8, 2023
  16. Elijah NewrenMay 11, 2023
  17. Tao KlerksMay 21, 2023

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.