From: Jeff King <peff@peff.net>
To: "Σπύρος Βαζαίος" <sbazaios@gmail.com>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: make git diff output easier to read - use better diff heuristics
Date: Tue, 13 Feb 2018 11:08:24 -0500 [thread overview]
Message-ID: <20180213160824.GA5203@sigill.intra.peff.net> (raw)
In-Reply-To: <CAOmC-AncOZfAwowXLjwDbL9Bdx1+=RbXsrd72LzEBd2W-=LAQg@mail.gmail.com>
On Tue, Feb 13, 2018 at 05:06:15PM +0200, Σπύρος Βαζαίος wrote:
> Hi, I've came across an issue when using the git diff command. In
> particular the diff is different to what the svn diff produces. While
> both being correct the output of the svn diff is easier to understand
> than the git diff one. See the following issue on github where I
> initially reported the issue:
>
> https://github.com/git-for-windows/git/issues/1494
>
> I have Included a picture to better illustrate the problem. What do
> you think? Is it possible to make git diff output similar to svn diff
> regarding this issue?
Try "git diff --no-indent-heuristic", which makes your example look
better. Here's a quick reproduction:
-- >8 --
cat >foo.c <<\EOF
static struct foo bar[] = {
#ifdef SOMETHING
{ "stats.info", MNU_GBX_FSTAINF, etc },
{ "expired.info", MNU_GBX_FSTAINF, etc },
{ "info.log", MNU_GBX_INFOLOG, etc },
#endif
{ NULL, 0, 0 },
};
EOF
sed '6a\
#ifdef WITH_EMU\
{ "SoftCam.Key", MNU_CFG_FSOFTCAMKEY, etc },\
#endif
' <foo.c >bar.c
-- 8< --
Now this looks ugly:
git diff --no-index foo.c bar.c
but this does not:
git diff --no-index --no-indent-heuristic foo.c bar.c
That heuristic is described in 433860f3d0 (diff: improve positioning of
add/delete blocks in diffs, 2016-09-05). I'm not sure exactly why it
does the wrong thing here, or if it would be possible to tweak the
weighting factors to make it work.
-Peff
next prev parent reply other threads:[~2018-02-13 16:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 15:06 make git diff output easier to read - use better diff heuristics Σπύρος Βαζαίος
2018-02-13 16:08 ` Jeff King [this message]
2018-02-13 18:11 ` Stefan Beller
2018-02-13 18:25 ` Σπύρος Βαζαίος
2018-02-13 22:41 ` Michael Haggerty
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=20180213160824.GA5203@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=sbazaios@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.
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).