From: Michael J Gruber Date: Wed, 15 Dec 2010 09:06:21 GMT Subject: Re: html userdiff is not showing all my changes Message-ID: <4D08850D.3010402@drmicha.warpmail.net> In-Reply-To: <561247.22837.qm@web110707.mail.gq1.yahoo.com> Scott Johnson venit, vidit, dixit 15.12.2010 04:47: > I am attempting to do a word diff of an html source file. Part of the removed > html is disappearing from the diff when I enable the fancy html word diff. > > Here's the output from basic `git diff`: > diff --git a/adv_layout_source.html b/adv_layout_source.html > index 18a81dd..c4ed609 100644 > --- a/adv_layout_source.html > +++ b/adv_layout_source.html > @@ -42,8 +42,8 @@ > > > > Here's the default `git diff --word-diff`: > diff --git a/adv_layout_source.html b/adv_layout_source.html > index 18a81dd..c4ed609 100644 > --- a/adv_layout_source.html > +++ b/adv_layout_source.html > @@ -42,8 +42,8 @@ > > > Which is correct, but less than ideal because it highlights much more than the > actual changes. > > So I create a .gitattributes file with one line: > *.html diff=html > > And rerun `git diff --word-diff`: > diff --git a/adv_layout_source.html b/adv_layout_source.html > index 18a81dd..c4ed609 100644 > --- a/adv_layout_source.html > +++ b/adv_layout_source.html > @@ -42,8 +42,8 @@ > > > Yikes! What happened to the second line of changes? The removed code is not > displayed at all. > > This is running git 1.7.3.3. > > I suspect the problem is in the html patterns in userdiff.c, but I don't > understand the word-diff-regex well enough to fix it. The wordRegex should really only control what comprises a word, i.e. the granularity of --word-diff. (Where do we insert additional line-breaks before running ordinary diff?) If a wordRegex can make parts of diff disappear than there is problem deeper in the diff machinery. Can you trim this down to a minimal example? Michael