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

Re: [RFC PATCH] stash: accept options also when subcommand 'save' is omitted

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 19, 2009, 07:14 UTC
Message-ID
<vpqzl9wz35u.fsf@bauges.imag.fr>
In-Reply-To
<alpine.DEB.1.00.0908190035140.8306@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 15 quoted lines
> Hi,
>
> On Tue, 18 Aug 2009, Matthieu Moy wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> 
>> > But it is sloppy, in that it blindly accepts options that might be 
>> > valid for several subcommands, not just "save".
>> 
>> I wouldn't call that sloppy. 'save' is the default command, if you don't 
>> provide any command, then 'save' will be used.
>
> 'save' might be the default command, but we don't trigger it with _any_ 
> crap, for a very good reason.  Read the commit log for git-stash.sh to 
> know why.

The good reason was people doing a typo when typing a command, like 'git stash aply' or so. And yes, I did find this annoying. The question of someone omitting the subcommand is very different to me. On can hardly type 'git stash -q' and claim he explicitely wanted to run 'pop'.

Your proposal will almost certainly trigger complains from users:

git stash -k => works git stash -k -q => doesn't work git stash -k "name of stash" => doesn't work git stash save -k "name of stash" => works git stash -p => works with another patch merged in next git stash -q => doesn't work git stash --patch --no-keep-index => works git stash --no-keep-index --patch => doesn't work

You'll have a hard time explaining that to bare mortals.
Look at what's the code's becomming:
+       0,,|1,-k,|1,--keep-index,|1,-p,|1,--patch,|2,-p,--no-keep-index|2,--patch,--no-keep-index)

when the code starts having to enumerate so many possibilities instead of having a simple logic, something's going wrong.

-- 
Matthieu
Previous: Johannes SchindelinNext: Jeff King
Message 19 of 22 in “stash: accept options also when subcommand 'save' is omitted”
  1. stash: accept options also when subcommand 'save' is omittedMatthieu Moy, Aug 18, 2009
  2. Matthieu MoyAug 18, 2009
  3. Jeff KingAug 18, 2009
  4. Junio C HamanoAug 18, 2009
  5. 0/3 short syntaxes for 'git stash'Matthieu Moy, Aug 18, 2009
  6. 1/3 stash: accept -k as a shortcut for --keep-indexMatthieu Moy, Aug 18, 2009
  7. 2/3 stash: accept options also when subcommand 'save' is omittedMatthieu Moy, Aug 18, 2009
  8. 3/3 stash: reject stash name starting with a dash.Matthieu Moy, Aug 18, 2009
  9. Jeff KingAug 18, 2009
  10. Junio C HamanoAug 18, 2009
  11. Jeff KingAug 18, 2009
  12. Junio C HamanoAug 18, 2009
  13. Matthieu MoyAug 19, 2009
  14. Jeff KingAug 19, 2009
  15. Jeff KingAug 18, 2009
  16. Johannes SchindelinAug 18, 2009
  17. Matthieu MoyAug 18, 2009
  18. Johannes SchindelinAug 18, 2009
  19. Matthieu MoyAug 19, 2009
  20. Jeff KingAug 18, 2009
  21. Johannes SchindelinAug 18, 2009
  22. Jeff KingAug 18, 2009

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.