git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Treating similar blank lines between hunks as part of the hunks
@ 2010-08-26 20:19 Timur Tabi
  2010-08-27  2:13 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2010-08-26 20:19 UTC (permalink / raw)
  To: git

Is there any way to convince git-diff to treat blank lines between two
hunks as part of the hunks for diffing?  That is, if I have these two
files:

-----
A
B
C

D
E
-----

and

-----
A
F
G

H
E
-----

git-diff will do this:

 A
-B
-C
+F
+G

-D
+H
 E

Instead, I would prefer it did this:

 A
-B
-C
-
-D
+F
+G
+
+H
E

This second diff is easier to read, especially when the number of
hunks is large, but the size of each hunk is small.  This can happen
in source code when one function is replaced with a completely
different function.  Git sees the blanks in each function as being
common, but everything else is completely different, so the diff is
unreabable.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Treating similar blank lines between hunks as part of the hunks
  2010-08-26 20:19 Treating similar blank lines between hunks as part of the hunks Timur Tabi
@ 2010-08-27  2:13 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2010-08-27  2:13 UTC (permalink / raw)
  To: Timur Tabi; +Cc: git

Timur Tabi wrote:

> git-diff will do this:
> 
>  A
> -B
> -C
> +F
> +G
> 
> -D
> +H
>  E
> 
> Instead, I would prefer it did this:
> 
>  A
> -B
> -C
> -
> -D
> +F
> +G
> +
> +H
> E
> 
> This second diff is easier to read, especially when the number of
> hunks is large, but the size of each hunk is small.  This can happen
> in source code when one function is replaced with a completely
> different function.

Not sure if it would help in your example, but have you tried
"git diff --patience"?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-27  2:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-26 20:19 Treating similar blank lines between hunks as part of the hunks Timur Tabi
2010-08-27  2:13 ` Jonathan Nieder

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).