Thread (1 message) 1 message, 1 author, 2021-10-12

Re: [PATCH RFC v1] stash: implement '--staged' option for 'push' and 'save'

From: Sergey Organov <hidden>
Date: 2021-10-12 11:20:09

Ævar Arnfjörð Bjarmason [off-list ref] writes:
On Tue, Oct 12 2021, Sergey Organov wrote:
quoted
Eric Sunshine [off-list ref] writes:
quoted
/On Mon, Oct 11, 2021 at 4:17 PM Sergey Organov [off-list ref] wrote:
quoted
Stash only the changes that are staged.

This mode allows to easily stash-out for later reuse some changes
unrelated to the current work in progress.

Unlike 'stash push --patch', --staged supports using of any tool to
select the changes to stash-out, including, but not limited to 'git
add --interactive'.
s/using of any/use of any/
...or...
s/using of any/using any/
Will fix, thanks!
quoted
quoted
Signed-off-by: Sergey Organov <redacted>
---
diff --git a/builtin/stash.c b/builtin/stash.c
@@ -1656,6 +1716,8 @@ static int save_stash(int argc, const char **argv, const char *prefix)
+               OPT_BOOL('S', "staged", &only_staged,
+                        N_("stash in patch mode")),
                OPT_BOOL('p', "patch", &patch_mode,
                         N_("stash in patch mode")),
                OPT__QUIET(&quiet, N_("quiet mode")),
Copy/paste error in new help/description string?
Yep.

Thanks,
I very much like this option, I've sometimes missed it in "git stash",
and was always going to dig into if there was some way to do it.

The one thing I'm a bit iffy on is if this is consistent with the
--staged options in other commands (with some taking --cached and/or
--staged), I think so, and this is a good name.

But is the -S option used as a shorthand for --staged somewhere else?
*Checks*, ah yes, for "git restore", then we use "stage" for
checkout-index/ls-files, the latter of which has a 's' (not
capital-letter 'S') shorthand.

I *think* that just -s/--stage would make more sense here, but I've only
looked at it briefly, but getting options consistent if possible is in
general quite nice for users, so we should think about it...
I grepped the Documentation/ and found -S,--staged in the
"git-restore.txt":

-S::
--staged::
        Specify the restore location.

, so I used the same shorthand, even though I personally would use -s as
well.

In addition, the problem with -s is that it's used in a lot of places
for entirely unrelated option(s).

Thanks,
-- Sergey Organov
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help