* Better handling of erroneous git stash save "somemessage" --keep-index
@ 2013-02-26 15:59 Gunnlaugur Thor Briem
2013-02-26 16:10 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Gunnlaugur Thor Briem @ 2013-02-26 15:59 UTC (permalink / raw)
To: git
Hi,
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.
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".
Cheers,
Gulli
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Better handling of erroneous git stash save "somemessage" --keep-index
2013-02-26 15:59 Better handling of erroneous git stash save "somemessage" --keep-index Gunnlaugur Thor Briem
@ 2013-02-26 16:10 ` Junio C Hamano
2013-02-26 16:21 ` Matthieu Moy
2013-02-26 16:46 ` Gunnlaugur Thor Briem
0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2013-02-26 16:10 UTC (permalink / raw)
To: Gunnlaugur Thor Briem; +Cc: git
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.
>
> 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? You may have a WIP to enhance the behaviour of one option and
you might want to say
git stash save wip: tweak behaviour of --keep-index
to save it away when switching to higher priority task.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Better handling of erroneous git stash save "somemessage" --keep-index
2013-02-26 16:10 ` Junio C Hamano
@ 2013-02-26 16:21 ` Matthieu Moy
2013-02-26 17:00 ` Junio C Hamano
2013-02-26 16:46 ` Gunnlaugur Thor Briem
1 sibling, 1 reply; 5+ messages in thread
From: Matthieu Moy @ 2013-02-26 16:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Gunnlaugur Thor Briem, git
Junio C Hamano <gitster@pobox.com> writes:
> 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.
>> 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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Better handling of erroneous git stash save "somemessage" --keep-index
2013-02-26 16:10 ` Junio C Hamano
2013-02-26 16:21 ` Matthieu Moy
@ 2013-02-26 16:46 ` Gunnlaugur Thor Briem
1 sibling, 0 replies; 5+ messages in thread
From: Gunnlaugur Thor Briem @ 2013-02-26 16:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, Feb 26, 2013 at 4:10 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Then the user cannot say
>
> git stash save some message that consists of multiple words
>
> no? You may have a WIP to enhance the behaviour of one option and
> you might want to say
>
> git stash save wip: tweak behaviour of --keep-index
>
> to save it away when switching to higher priority task.
In this case (which must be rarer than --keep-index intended as a
parameter) the user gets the error message, the problem is pretty
clear, and the workaround is very easy, quote the message:
git stash save "wip: tweak behaviour of --keep-index"
... which also is more conventional on the command line.
To minimize the behavior change, it could apply solely for the case of
known parameters to this command (like --keep-index), so that:
git stash save wip: tweak behaviour of --froob-nob
would still work like before. That's less consistent, but then again,
this is just a matter of catching very likely errors to avoid lost
work.
Expressing a multi-word message without quotes on the command line is
unconventional (in general, though maybe not in the use of git-stash)
so it seems reasonable to let that usage be the one that gets
inconvenienced.
-Gulli
(Sorry about the initial reply to you alone Junio)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Better handling of erroneous git stash save "somemessage" --keep-index
2013-02-26 16:21 ` Matthieu Moy
@ 2013-02-26 17:00 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2013-02-26 17:00 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Gunnlaugur Thor Briem, git
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> I didn't even know that multi-words messages would be allowed this way.
> That seems to me to be really weird indeed.
Yeah, but it is understandable why it was done that way, considering
taht the whole point of "stash" is to save away quickly for higher
priority interrupt. IIRC, earlier iterations of the command did not
even require you to say "save", i.e.
git stash wip: futzing with --keep-index
would have been a perfectly good invocation.
> 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.
Yeah, if the user wants to be more elaborate perhaps
git checkout -b temp
git commit -m 'whatever message' -a
git checkout -
would suffice; "stash" is for smaller changes in a very tentative
nature that do not deserve such a long command sequence, so
requiring "-m" may make the command less useful.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-26 17:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 15:59 Better handling of erroneous git stash save "somemessage" --keep-index Gunnlaugur Thor Briem
2013-02-26 16:10 ` Junio C Hamano
2013-02-26 16:21 ` Matthieu Moy
2013-02-26 17:00 ` Junio C Hamano
2013-02-26 16:46 ` Gunnlaugur Thor Briem
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).