Thread View: linux.kernel.git
3 messages
3 total messages
Started by ιη°δΈθ
Thu, 08 Oct 2026 13:58
Re: [PATCH v2] stash: expose untracked modes in create
Author: ιη°δΈθ
Date: Thu, 08 Oct 2026 13:58
Date: Thu, 08 Oct 2026 13:58
118 lines
14522 bytes
14522 bytes
Hi Junio, > Perhaps, but I do not think it is too huge a backward-compatibility > breakage to forbid giving a message lazily (i.e., all strings in > argv[] after 'git stash create' gets concatenated and becomes a > single message) that begins with "-", with an escape hatch that a > leading "-m" will take the next argv[] element as the message, for > example. If the compatibility change for messages beginning with `-` is acceptable with an `-m` escape hatch like the one you mentioned, I think a new subcommand is unnecessary. >> 3. Add something like `--create-only` to `git stash push`. > > This also would work and sounds the safest. I think so too, at least for the immediate change. But `stash create` is already intended for scripts, and I think we may want to add more script-oriented options to it in the future. If we put the create-only interface under `push`, each future option for that interface would also need a decision about whether it applies to ordinary `push`, `--create-only`, or both. That would add another set of option rules inside `push` that future additions would have to account for. So I currently think extending `stash create` directly is the better long-term approach. Phillip's comments about which options make sense for scripts also made me reconsider the scope of this patch. I realized that I had been treating two decisions as one: whether to introduce option parsing in `stash create`, and how much of what `do_create_stash()` already supports to expose now. I think adding option parsing and `-m/--message` now would be useful, even if we only expose a few options. That is because we should not need to revisit the basic parsing and message compatibility question just to add another script-oriented option later. That makes me think we don't need to expose everything `do_create_stash()` already supports in this patch. I now think we don't need to settle the public rules for other options and their interactions until there is a concrete need. In particular, I would prioritize leaving out options for which I haven't found a concrete request and whose interaction rules might make future additions harder if fixed now. So my conclusion for this patch is to expose `-m/-q/-u/-a`. The untracked modes address the original gap, and I think `-q/--quiet` makes sense for a script-oriented command. It would use the existing creation helper's quiet behavior without suppressing the object name returned on success. For now, I would leave `--patch` and pathspec support out. I also checked `-k/--keep-index`. It concerns the cleanup and preservation behavior of `push`, rather than creation of the stash object itself, so I would leave it out. I still need to think a little more about `--staged`. It does affect what goes into the stash object, but its interactions with other options are less straightforward. For example, `stash push` does not allow it with `-u/-a` or `--pathspec-from-file`, while patch mode takes precedence over it. So far I haven't found a concrete request specifically for `stash create --staged`, but I'm still checking. Unless I find one, I would like to leave `--staged` out of this patch rather than decide those interaction rules now. Thanks, Kazumasa Shigeta On Mon, 05 Oct 2026 09:43:03 -0700, Junio C Hamano <gitster@pobox.com> wrote: > ιη°δΈθ <kazumasa.shigeta@kanamei.com> writes: > > > Your question made me realize that I had focused too narrowly on the > > untracked modes. The larger issue is not simply that `do_create_stash()` > > has capabilities that `git stash create` does not expose. > > Brilliant. I agree that is the right way to frame the issue. > > > Making more of those capabilities available through `create` would > > therefore mean either changing that contract or designing around it. > > That is a much larger interface decision than I appreciated when I sent > > the patch. > > Perhaps, but I do not think it is too huge a backward-compatibility > breakage to forbid giving a message lazily (i.e., all strings in > argv[] after 'git stash create' gets concatenated and becomes a > single message) that begins with "-", with an escape hatch that a > leading "-m" will take the next argv[] element as the message, for > example. > > > 2. Add a new stash subcommand for the creation functionality. > > This is essentially how 'git stash save' came about, to give us ways > to control how a new stash entry is created and how the working tree > is cleared with command line options. In the beginning, you did not > even have to say 'save', because 'git stash <message>' was invented > as a way to say "the boss is here and tells me to work on something > unrelated. clear the slate with minimum number of keystrokes to > continue working on what I have been working on later." And that > later became 'git stash push'. > > > 3. Add something like `--create-only` to `git stash push`. > > This also would work and sounds the safest.
Re: [PATCH v2] stash: expose untracked modes in create
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 19:05
Date: Fri, 09 Oct 2026 19:05
45 lines
12261 bytes
12261 bytes
ιη°δΈθ <kazumasa.shigeta@kanamei.com> writes: > I realized that I had been treating two decisions as one: > whether to introduce option parsing in `stash create`, and how much > of what `do_create_stash()` already supports to expose now. > > I think adding option parsing and `-m/--message` now would be useful, > even if we only expose a few options. That is because we should not > need to revisit the basic parsing and message compatibility question > just to add another script-oriented option later. > > That makes me think we don't need to expose everything > `do_create_stash()` already supports in this patch. I now think > we don't need to settle the public rules for other options and > their interactions until there is a concrete need. > > In particular, I would prioritize leaving out options for which > I haven't found a concrete request and whose interaction rules > might make future additions harder if fixed now. Stepping back a bit, I think the long-term goal should be to extend the 'create' and 'store' pair sufficiently to allow script writers to write their own 'git stash push' on top of them if they wanted to. 'git stash create' does not have to be fully capable of doing so with the current topic alone, but do you agree that improving 'create' in such a way should be our long-term goal? With that future vision in mind, I am not sure I follow what you said above. Shouldn't 'stash create --foo' work the same way as 'stash push --foo' while creating the stash entry, if '--foo' is not an option relevant only to 'stash store'? Under what circumstances does a '--foo' option that 'push' has (and for which you have not seen a request) have to behave differently when added to 'create', leaving a stash entry of a different shape from the one 'push --foo' would create? If the wish is "we want to start small because thinking about each and every one of them and making sure they work correctly is too much work for my liking", I would understand. But I do not understand how "we worry we may overspecify without knowing the need" would apply to this particular case, even though it is a good thing to keep in mind in other situations. Thanks.
Re: [PATCH v2] stash: expose untracked modes in create
Author: ιη°δΈθ
Date: Sat, 10 Oct 2026 06:34
Date: Sat, 10 Oct 2026 06:34
31 lines
10575 bytes
10575 bytes
> 'git stash create' does not have to be fully capable of doing > so with the current topic alone, but do you agree that improving > 'create' in such a way should be our long-term goal? Yes, I agree. > Shouldn't 'stash create --foo' work the same way as > 'stash push --foo' while creating the stash entry, if '--foo' is > not an option relevant only to 'stash store'? Yes, that's exactly what I had in mind. > If the wish is "we want to start small because thinking about > each and every one of them and making sure they work correctly > is too much work for my liking", I would understand. Yes, that is what I meant. When you asked why I was singling out `-u` and `-a`, I went back and examined the other options. I'm glad I did. It helped me understand `stash create` better. Thank you for raising that question. But when I tried to explain why I wanted to leave the other options out, I gave a poor reason. Sorry for the confusion. With that in mind, I'd like to limit this patch to `-m/-q/-u/-a` and leave `--patch`, `--staged`, and pathspec support for follow-up patches. Does that sound reasonable? Thanks, Kazumasa Shigeta
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads