Re: [PATCHv5 1/3] wt-status.*: better advices for git status added
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 1, 2012, 16:51 UTC
- Message-ID
- <7v396f3rhg.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20120601111651.Horde.R0mdSHwdC4BPyIiDyUHhUVA@webmail.minatec.grenoble-inp.fr>
konglu@minatec.inpg.fr writes:
Show 22 quoted lines
>>> + } else {
>>> + status_printf_ln(s, color, _("You are currently editing a commit
>>> during a rebase."));
>>> + if (advice_status_hints) {
>>> + status_printf_ln(s, color, _(" You can amend the commit with"));
>>> + status_printf_ln(s, color, _(" git commit --amend"));
>>> + status_printf_ln(s, color, _(" Once you are satisfied with
>>> your changes, run"));
>>> + status_printf_ln(s, color, _(" git rebase --continue"));
>>
>> For an advice in "git status" output, the above may be appropriate,
>> but would the user see this in "git commit" template, and if so,
>> isn't it because the user typed "git commit --amend"? Does it make
>> sense to suggest to run "git commit --amend" in that context?
>
> True, the user will see the messages in the "git commit" template. We
> didn't take this case into account because we thought that not many people
> read the status in the "git commit" template. Anyway, just adding a condition
>
> if (advice_status_hints && !s->amend)
>
> does the job.Hrm, what would happen if the user ran "git commit" without --amend?
It could be done by mistake, which will be greatly helped by the information you already gathered during the inspection phase.
This also can be done deliberately to split a commit in "rebase -i", so "You are in 'rebase -i', do not commit without --amend!" is a wrong message, but it may be sensible to give "are you sure you meant to commit without --amend?"