From: Junio C Hamano <gitster@pobox.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix amending of a commit with an empty message
Date: Thu, 21 Feb 2008 14:01:44 -0800 [thread overview]
Message-ID: <7v8x1et1dj.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080221213204.GC20143@steel.home> (Alex Riesen's message of "Thu, 21 Feb 2008 22:32:04 +0100")
Alex Riesen <raa.lkml@gmail.com> writes:
>> Having said that, here is a quiz. When the user says "git
>> commit --amend", what are the valid reasons not to allow it,
>> other than:
>>
>> - the index is unmerged.
>> - the branch is yet to be born.
>
> There are no tree changes in the commit to be amended.
> And if there is a strong wish to do just the amendment,
> there is always --allow-empty.
If the original commit had some changes, but the final tree,
after hacking, experimenting and fixing, ended up in the same
shape as the parent's, the user might rather want to "reset
HEAD^" away the commit than amending now-empty commit. Erroring
out when --allow-empty is not given (like we currently do) would
be sensible in such a case.
However, if the original commit was made with --allow-empty, it
might have been done for a reason, and I was not sure if forcing
the user to say --allow-empty while amending (like we currently
do) was such a good idea. The user previously may have created
that empty (in content changes) commit to piss in the snow, or
perhaps the empty commit is due to foreign SCM import, and the
user may be trying to improve the log message that is attached
to it. The user might even be an automated script in the case
of foreign SCM import, but admittedly, it could choose to always
say --allow-empty.
That was the motivation behind that quiz.
next prev parent reply other threads:[~2008-02-21 22:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 19:54 [PATCH] A test for commit --amend allowing changing of a very empty commit message Alex Riesen
2008-02-21 20:23 ` Junio C Hamano
2008-02-21 20:35 ` Alex Riesen
2008-02-21 20:38 ` [PATCH] Fix amending of a commit with an empty message Alex Riesen
2008-02-21 20:56 ` Junio C Hamano
2008-02-21 21:32 ` Alex Riesen
2008-02-21 22:01 ` Junio C Hamano [this message]
2008-02-21 20:57 ` [PATCH] A test for commit --amend allowing changing of a very empty commit message Johannes Schindelin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v8x1et1dj.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=raa.lkml@gmail.com \
/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.
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).