git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Lukas Gross <lukasgross@u.northwestern.edu>,
	git@vger.kernel.org
Subject: Re: amend warnings with no changes staged
Date: Thu, 8 Aug 2019 05:46:08 -0400	[thread overview]
Message-ID: <20190808094607.GB12257@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqblx2jeh2.fsf@gitster-ct.c.googlers.com>

On Tue, Aug 06, 2019 at 12:11:53PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> >   git commit -m 'buggy commit'
> >   echo fix >>file.c
> >   git commit --amend ;# oops, should have been "-a"
> >   git push
> >
> > But perhaps that gets to the heart of the matter. Could we perhaps be
> > providing a more detailed summary of what happened for an --amend? I.e.,
> > to summarize _both_ sets of changes (and if one set is empty, say so)?
> > ...
> > judgement about whether it's an error, since it may well be that you
> > were simply rewording the commit message).
> 
> Perhaps "git range-diff HEAD@{1}...HEAD" being an empty is a sign
> that either the user intentionally or accidentally did not do
> anything other than "touch"ing the commit.
> 
> "git commit --amend --[no-]range-diff" that shows what you changed
> with the amending may be an interesting possibility; I am not yet
> ready to seriously encourage anybody to explore it, though, because
> "git diff HEAD@{1}" is much easier to see what code got changed, but
> one (and probably only) downside is that it does not cover the
> change in the log message.

I hadn't even thought of range-diff.

Showing the commit message diff would be a big improvement. A range-diff
would also show an update to the author (e.g., if you used --reset-author).

We don't really need the full power of range diff, though. After all, we
know there are exactly two patches to compare, so we don't care about it
trying to figure out which ones correlate (and it might even be a bad
thing for it to decide that two entries don't match). So I think we'd
probably want our own custom thing.

-Peff

      reply	other threads:[~2019-08-08  9:46 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
2019-08-06  4:19       ` Jeff King
2019-08-06 19:11         ` Junio C Hamano
2019-08-08  9:46           ` Jeff King [this message]

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=20190808094607.GB12257@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=lukasgross@u.northwestern.edu \
    /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).