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[] = {
        { "stats.info", MNU_GBX_FSTAINF, etc },
        { "expired.info", MNU_GBX_FSTAINF, etc },
        { "info.log", MNU_GBX_INFOLOG, etc },
        { NULL, 0, 0 },

sed '6a\
#ifdef WITH_EMU\
        { "SoftCam.Key", MNU_CFG_FSOFTCAMKEY, etc },\
' <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.


Reply via email to