[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Extra options for libsvn_diff

From: Bruce DeVisser <bmdmail_at_sympatico.ca>
Date: 2006-02-16 14:08:14 CET

On Thu, Feb 16, 2006 at 09:44:24AM +0100, Peter N. Lundblad wrote:
> On Thu, 16 Feb 2006, Bruce DeVisser wrote:
>
> > > + default:
> > > + /* Some other whitespace character. */
> > > + if (opts->ignore_space)
> > > + {
> > > + state = state_whitespace;
> > > + if (opts->ignore_space
> > > + == svn_diff_file_ignore_space_change)
> > > + *newend++ = ' ';
> > > + }
> > > + break;
> >
> > This appears to implement a purist definition of space-change
> > (whitespace at end-of-line is not folded into the newline),
> > unlike GNU diff. Not that there's anything wrong with that; just
> > pointing it out.
> >
> I first implemented ignore-space-at-eol-totally like GNU diff, but it
> didn't work since I am normalizing in-place. If people think this is
> important, I see no other way than using an extra buffer.

What if you do not output whitespace at the transition into the
state_whitespace state, but rather at the transition back out of
it into state_normal?
>
Argh. I just realised the state machine will be 'storing' a space
that will have nowhere to go if it is in state_whitespace when a
new buffer arrives. Is that what you mean by needing an extra
buffer? If so, I'm not sure how you would work around a space at
the end of an incoming buffer.

To work around this, you don't necessarily need an extra buffer,
just a buffer that is one character longer (or content that
starts in the second byte). But maybe that would be too complex
on the calling side.

But again, there is no hard requirement to support GNU behaviour.

> >
> > > + case state_cr:
> > > + if (*curp == '\n' && opts->ignore_eol_style)
> > > + start = curp + 1;
> > > + state = state_normal;
> > > + }
> >
> > Mac text (CR-only) will foul up space-ignore logic for whitespace
> > at the start of the next line, I think. (Sorry, I can't test it
> > right now.)
> >
> Good catch! It would include a space at the beginning of the next line
> unconditionally. I fixed this by (ab)using the C switch statement.

I think a side-effect of the fix suggested above is also fixing
this. Another approach is to 'simply' unadvance curp and let the
next iteration of the loop handle it in state_normal.

Bruce

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 16 14:09:25 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.