From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, Jonathan Nieder <jrnieder@gmail.com>
Cc: Lukas Gross <lukasgross@u.northwestern.edu>,
git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: amend warnings with no changes staged
Date: Tue, 6 Aug 2019 17:32:07 +0100 [thread overview]
Message-ID: <b12f58f6-663a-bd0f-5854-d7ff0b83848b@gmail.com> (raw)
In-Reply-To: <xmqqh86vkl0j.fsf@gitster-ct.c.googlers.com>
On 06/08/2019 04:53, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Jonathan Nieder <jrnieder@gmail.com> writes:
>>
>>>>> Some non-judgemental descriptive output like
>>>>>
>>>>> $ git commit --amend --no-edit
>>>>> No changes.
>>>>> $
>>>>>
>>>>> would address this case, without bothering people who are doing it
>>>>> intentionally. So I think there's room for a simple improvement here.
>>>>
>>>> I do that to refresh the committer timestamp.
>>>
>>> I do, too. The proposal is, paraphrasing,
>>>
>>> $ git commit --amend --no-edit
>>> Ah, I see that you want me to refresh the committer timestamp.
>>> Done, as requested.
>>> $
>>
>> Ah, OK then. I somehow misread "No changes." as an error message.
>
> Well, on second thought, I think "fatal: no changes" that exits with
> non-zero, with "--force" as an escape hatch for those who want to
> refresh the committer timestamp, would probably be more in line with
> the expectation Lukas had when this thread was started, and I further
> suspect that it might be a bit more end-user friendly.
I agree that this would be the must user friendly way of doing it. I
think refreshing the timestamp is probably a niche use of '--amend' (out
of interest what the the motivation for doing that?) although it does
seem to popular with the other contributors to this thread. We could
always have a transition period with an opt-in config variable. I find
the current behavior quite annoying when I've forgotten to stage
anything as there is no indication the the commit's content is
unchanged. I've been using a wrapper script that errors out if there are
no new changes staged with --amend --no-edit and found it very helpful
(as is a proper --reword option rather than having to give --amend --only)
Best Wishes
Phillip
>
> It is a backward incompatible behaviour, but I suspect that if I
> were inventing "commit --amend" today, unlike 8588452c ("git-commit
> --amend: allow empty commit.", 2006-03-04), I probably would design
> it that way. After all, failing and stopping is always a safer
> option than going ahead with or without a report.
>
> I am not sure which one between "go ahead anyway but report" and
> "fail by default but allow forcing" I would prefer more. At least
> not yet. But I won't rule the latter out at this point.
>
> Thanks.
>
next prev parent reply other threads:[~2019-08-06 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 0:28 amend warnings with no changes staged Lukas Gross
2019-08-06 1:30 ` Jonathan Nieder
2019-08-06 1:37 ` Lukas Gross
2019-08-06 2:01 ` Jonathan Nieder
2019-08-06 2:16 ` Jonathan Nieder
2019-08-06 2:47 ` Junio C Hamano
2019-08-06 3:00 ` Jonathan Nieder
2019-08-06 3:29 ` Junio C Hamano
2019-08-06 3:53 ` Junio C Hamano
2019-08-06 16:32 ` Phillip Wood [this message]
2019-08-06 4:19 ` Jeff King
2019-08-06 19:11 ` Junio C Hamano
2019-08-08 9:46 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b12f58f6-663a-bd0f-5854-d7ff0b83848b@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=lukasgross@u.northwestern.edu \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).