git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Johannes Altmanninger <aclopte@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, newren@gmail.com, peff@peff.net
Subject: Re: range-diff should suppress context-only changes?
Date: Tue, 17 Nov 2020 22:35:48 +0100	[thread overview]
Message-ID: <20201117213551.2539438-1-aclopte@gmail.com> (raw)
In-Reply-To: <xmqqmtzvikwi.fsf@gitster.c.googlers.com>

> > I wonder if it would be reasonable to suppress range-diff hunks in which
> > all of the changed lines are context lines.
> 
> Sounds like a reasonable thing to do.  As we know the shape of what
> is compared in the outer diff we should be able to accurately notice
> where hunk boundaries are and a hunk whose change is only on context
> lines.

Here are patches to ignore context-only changes in range-diff's output.
I'm not completely happy with the changes, they feel a bit too hacky.
Maybe someone has better ideas.

This still gives output like this one, that could be improved in future

	1:  7a3dac8 ! 1:  119bc78 Change
	    @@ some-other-file
	      7
	      8
	      9
	    - Old context line
	    + New context line

	    -## file ##
	    +## file => renamed-file ##
	     @@
	      1
	     -2


I think it should be

	1:  7a3dac8 ! 1:  119bc78 Change
	    -## file ##
	    +## file => renamed-file ##
	     @@
	      1
	     -2

I'm not sure if this is a feasible improvement.

"## <filename> ##" normally is a diff
section header (hence the "@@ some-other-file" hunk above) but here the
section header itself is changed..



  reply	other threads:[~2020-11-17 21:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 13:34 Jeff King
2020-11-05 20:55 ` Junio C Hamano
2020-11-17 21:35   ` Johannes Altmanninger [this message]
2020-11-17 21:35     ` [PATCH 1/3] range-diff: move " ## filename ##" headers to the first column Johannes Altmanninger
2020-11-17 21:35     ` [PATCH 2/3] range-diff: ignore context-only changes Johannes Altmanninger
2020-11-17 22:56       ` Eric Sunshine
2020-11-17 21:35     ` [PATCH 3/3] range-diff: only compute patch diff when patches are different Johannes Altmanninger

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=20201117213551.2539438-1-aclopte@gmail.com \
    --to=aclopte@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --subject='Re: range-diff should suppress context-only changes?' \
    /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

Code repositories for project(s) associated with this 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).