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

Re: Better handling of erroneous git stash save "somemessage" --keep-index

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Feb 26, 2013, 16:21 UTC
Message-ID
<vpq1uc3cagy.fsf@grenoble-inp.fr>
In-Reply-To
<7vwqtvm4yr.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> Gunnlaugur Thor Briem <gunnlaugur@gmail.com> writes:
>
>> the command:
>>
>> git stash save "some message" --keep-index
>>
>> stashes everything, including the index, and adds the "--keep-index"
>> to the message. The manual labor of separating index hunks from hunks
>> to stash is lost. This is in version 1.8.1.3.

Not lost, it's saved as part of the stash. "git stash pop --index" will restore it.

Show 10 quoted lines
>> This is a user error, of course (per the man page, parameters are not
>> accepted after the message). But it would be better handled by
>> erroring out, with a message like "git stash save does not permit
>> parameters after the stash message".
>
> Then the user cannot say
>
> 	git stash save some message that consists of multiple words
>
> no?

I didn't even know that multi-words messages would be allowed this way. That seems to me to be really weird indeed.

I can't say
  git commit -m multi word message

so why would people want to omit quotes for "git stash" is a total mystery. That said, we can't deny it right now, to preserve backward compatibility.

My feeling is that "git stash save" should learn a "-m, --message" option analogous to the one of "git commit", and then the "message on the command-line" syntax could be deprecated.

(One nice side effect would be that in the very long term, we may want to allow "git stash save -- <pathspecs>" to do a limited stash)

But maybe it's not worth the effort, I don't know.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “Better handling of erroneous git stash save "somemessage" --keep-index”
  1. Gunnlaugur Thor BriemFeb 26, 2013
  2. Junio C HamanoFeb 26, 2013
  3. Matthieu MoyFeb 26, 2013
  4. Junio C HamanoFeb 26, 2013
  5. Gunnlaugur Thor BriemFeb 26, 2013

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.