Re: [PATCH v2 3/8] checkout: validate stage and merge option compatibility in checkout_paths()
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Sep 3, 2026, 09:21 UTC
- Message-ID
- <CAOLa=ZSeVEAxmckAmApQ4jsOnQ9=nK5+H0-10s-TmFWqGU-URg@mail.gmail.com>
- In-Reply-To
- <xmqqo6efff9l.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 27 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes: > >> Sorry if I was unclear. I was stating that the condition udner which the >> check runs is now difference. Previously we checked `opts->pathspec.nr`, >> but now `checkout_paths()` is also entered for '--patch' without any >> path spec. >> >> Having a closer look, it seems to be okay. Because in patch mode, each >> of the combinations is already rejected before in `checkout_paths()`. > > Yes, that was why I did not see what difference between the code > before and after the change you were concerned about. > >> It still might be good to have a sentence in a the commit message, since >> the guard did change and the reasoning why that is safe is not so >> obvious. > > Perhaps. > > Having done this, I do not particularly think these changes and > refactorings are all that useful. As unit of reusable code, an > entire command (like "git restore") may still be too coarse and > callers would want a finer grained control out of "Git restore > callable from C programmatically, without having to go through > run_command() interface", which means the caller has to still > formulate argv[] array in order to call them. These 8 patches may > give us a good starting point, but it merely scratches the surface.
I do think there is merit in merging this down since it leaves us in a better place than before.