You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Stanimir Stamenkov <s7...@netscape.net> on 2011/04/20 19:44:08 UTC

svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

The '--ignore-space-change' option, and '--ignore-all-space' for 
that matter, to the 'diff' and 'blame' commands doesn't seem to 
ignore changes in the EOL style.  I really expect each of:

--ignore-eol-style
--ignore-space-change
--ignore-all-space

in the given order to include the effect of the previous one.  There 
are many files which get initially created on Windows with CRLF 
line-endings, but without the 'svn:eol-style=native' property set. 
Then at some revision this property gets set and it gets very 
difficult track/find the origin of past changes, onwards.  The 
problem gets messier when the EOL style changes to LF and CRLF 
number of times before the 'svn:eol-style' gets properly set.

Now, one could think:

svn diff / blame -x --ignore-eol-style ...

should be sufficient.  But then often I need to use:

svn diff / blame -x --ignore-space-change ...

to ignore any space changes, e.g. changes to "tabs vs. spaces-only" 
to the indentation (and elsewhere), which becomes impossible once 
the file has changed the EOL style number of times.

Is the current behavior of the space ignoring options intended, or 
it appears omission?

FWIW, I'm on Windows and I workaround the problem by having 
installed the 'diff' command from the GnuWin32 [1] packages, which 
doesn't seem to care about EOL style differences (treats them as equal):

svn diff / blame --diff-cmd diff -x "--ignore-space-change ..." ...

It would be really nice if the SVN default internal diff 
implementation adds the effect of '--ignore-eol-style' to the 
'--ignore-space-change' and '--ignore-all-space' options.

[1] http://gnuwin32.sourceforge.net/

-- 
Stanimir

Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.

On Thu, 21 Apr 2011 07:16 +0300, "Stanimir Stamenkov" <s7...@netscape.net> wrote:
> Thu, 21 Apr 2011 07:07:31 +0300, /Daniel Shahaf/:
> > On Wed, 20 Apr 2011 21:38 +0200, "Johan Corveleyn" wrote:
> >> Can't you just use both options?
> >>      svn diff / blame -x --ignore-space-change -x --ignore-eol-style
> >>
> >> Or, with the short option for ignoring space-change:
> >>      svn diff / blame -x-b -x--ignore-eol-style
> >
> > And here I thought the syntax would be
> >
> > svn $subcommand -x "--ignore-space-change --ignore-eol-style"
> >
> > though, of course, if your syntax works I'll use it from now on
> > (because it's more easily parseable).
> 
> That's what I've found, also.  Thank you both Johan and Daniel, for 
> helping me figuring it out.
> 

Issue #3864.

http://subversion.tigris.org/issues/show_bug.cgi?id=3864

I've marked it for 2.0 since it's not a compatible change.  (I like the idea though)

Daniel

Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Thu, 21 Apr 2011 07:07:31 +0300, /Daniel Shahaf/:
> On Wed, 20 Apr 2011 21:38 +0200, "Johan Corveleyn" wrote:
>
>> No, I don't think that's correct.
>>
>> --ignore-space-change: ignores changes in the amount of white-space,
>> but not ignoring "all white-space". This means that "having no
>> white-space" in not considered equal to "having white-space". Example:
>> "abc       def" is considered equal to "abc def", but not equal to
>> "abcdef".
>>
>> --ignore-all-space: ignores all differences in white-space, including
>> between "having no white-space" and "having white-space". I.e. "abc
>>   def" is considered equal to "abcdef".
>>
>> The above two only apply to white-space, not to eol-style, if I'm not
>> mistaken.
>
> Thanks for the correction, Johan.  (I haven't tested your theory
> either, but I assumed you'd jump in if I were spreading
> misinformation about the diff code.)
>
>> So the --ignore-eol-style is orthogonal.
>>
>> Can't you just use both options?
>>      svn diff / blame -x --ignore-space-change -x --ignore-eol-style
>>
>> Or, with the short option for ignoring space-change:
>>      svn diff / blame -x-b -x--ignore-eol-style
>
> And here I thought the syntax would be
>
> svn $subcommand -x "--ignore-space-change --ignore-eol-style"
>
> though, of course, if your syntax works I'll use it from now on
> (because it's more easily parseable).

That's what I've found, also.  Thank you both Johan and Daniel, for 
helping me figuring it out.

-- 
Stanimir

Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.

On Wed, 20 Apr 2011 21:38 +0200, "Johan Corveleyn" <jc...@gmail.com> wrote:
> No, I don't think that's correct.
> 
> --ignore-space-change: ignores changes in the amount of white-space,
> but not ignoring "all white-space". This means that "having no
> white-space" in not considered equal to "having white-space". Example:
> "abc       def" is considered equal to "abc def", but not equal to
> "abcdef".
> 
> --ignore-all-space: ignores all differences in white-space, including
> between "having no white-space" and "having white-space". I.e. "abc
>  def" is considered equal to "abcdef".
> 
> The above two only apply to white-space, not to eol-style, if I'm not
> mistaken.

Thanks for the correction, Johan.  (I haven't tested your theory either, but I assumed you'd jump in if I were spreading misinformation about the diff code.)

> So the --ignore-eol-style is orthogonal.
> 
> Can't you just use both options?
>     svn diff / blame -x --ignore-space-change -x --ignore-eol-style
> 
> Or, with the short option for ignoring space-change:
>     svn diff / blame -x-b -x--ignore-eol-style
> 

And here I thought the syntax would be

svn $subcommand -x "--ignore-space-change --ignore-eol-style"

though, of course, if your syntax works I'll use it from now on (because it's more easily parseable).

> (I generally prefer using --ignore-space-change instead of
> --ignore-all-space, because the latter can hide really important
> changes, which change the semantics e.g. in most programming languages
> or xml files and such).
> 
> Cheers,
> -- 
> Johan
> 
> On Wed, Apr 20, 2011 at 8:03 PM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > AIUI, --ignore-eol-style + --ignore-space-change == --ignore-all-space.  It seems to me that --ignore-all-space would work for your use case?
> >
> > On Wed, 20 Apr 2011 20:44 +0300, "Stanimir Stamenkov" <s7...@netscape.net> wrote:
> >> The '--ignore-space-change' option, and '--ignore-all-space' for
> >> that matter, to the 'diff' and 'blame' commands doesn't seem to
> >> ignore changes in the EOL style.  I really expect each of:
> >>
> >> --ignore-eol-style
> >> --ignore-space-change
> >> --ignore-all-space
> >>
> >> in the given order to include the effect of the previous one.  There
> >> are many files which get initially created on Windows with CRLF
> >> line-endings, but without the 'svn:eol-style=native' property set.
> >> Then at some revision this property gets set and it gets very
> >> difficult track/find the origin of past changes, onwards.  The
> >> problem gets messier when the EOL style changes to LF and CRLF
> >> number of times before the 'svn:eol-style' gets properly set.
> >>
> >> Now, one could think:
> >>
> >> svn diff / blame -x --ignore-eol-style ...
> >>
> >> should be sufficient.  But then often I need to use:
> >>
> >> svn diff / blame -x --ignore-space-change ...
> >>
> >> to ignore any space changes, e.g. changes to "tabs vs. spaces-only"
> >> to the indentation (and elsewhere), which becomes impossible once
> >> the file has changed the EOL style number of times.
> >>
> >> Is the current behavior of the space ignoring options intended, or
> >> it appears omission?
> >>
> >> FWIW, I'm on Windows and I workaround the problem by having
> >> installed the 'diff' command from the GnuWin32 [1] packages, which
> >> doesn't seem to care about EOL style differences (treats them as equal):
> >>
> >> svn diff / blame --diff-cmd diff -x "--ignore-space-change ..." ...
> >>
> >> It would be really nice if the SVN default internal diff
> >> implementation adds the effect of '--ignore-eol-style' to the
> >> '--ignore-space-change' and '--ignore-all-space' options.
> >>
> >> [1] http://gnuwin32.sourceforge.net/
> >>
> >> --
> >> Stanimir
> >>
> >
> 

Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Wed, 20 Apr 2011 21:38:55 +0200, /Johan Corveleyn/:
> On Wed, Apr 20, 2011 at 8:03 PM, Daniel Shahaf wrote:
>
>> AIUI, --ignore-eol-style + --ignore-space-change == 
>> --ignore-all-space.  It seems to me that --ignore-all-space would 
>> work for your use case? 
>
> No, I don't think that's correct.
>
> --ignore-space-change: ignores changes in the amount of 
> white-space, but not ignoring "all white-space". This means that 
> "having no white-space" in not considered equal to "having 
> white-space". Example: "abc       def" is considered equal to "abc def", 
> but not equal to "abcdef".
>
> --ignore-all-space: ignores all differences in white-space, 
> including between "having no white-space" and "having 
> white-space". I.e. "abc def" is considered equal to "abcdef".
>
> The above two only apply to white-space, not to eol-style, if I'm 
> not mistaken. So the --ignore-eol-style is orthogonal.

Yes, that's correct, and --ignore-all-space is not equal to 
--ignore-eol-style + --ignore-space-change.  Moreover 
--ignore-all-space is not as useful as --ignore-space-change, as 
Johan points later, but see further comments.

> Can't you just use both options?
>     svn diff / blame -x --ignore-space-change -x --ignore-eol-style
>
> Or, with the short option for ignoring space-change:
>     svn diff / blame -x-b -x--ignore-eol-style

You know, I've previously tried this many times and it didn't work 
as it basically picks just the last '-x' option discarding the 
previous ones, but that made me try what I've been using with the 
external 'diff' command (this is on Windows):

     svn diff -x "-b --ignore-eol-style" ...

and it appears to work as expected.  I just needed to group all the 
needed options.  Thanks a bunch!  :-)

> (I generally prefer using --ignore-space-change instead of 
> --ignore-all-space, because the latter can hide really important 
> changes, which change the semantics e.g. in most programming 
> languages or xml files and such).

-- 
Stanimir


Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Johan Corveleyn <jc...@gmail.com>.
No, I don't think that's correct.

--ignore-space-change: ignores changes in the amount of white-space,
but not ignoring "all white-space". This means that "having no
white-space" in not considered equal to "having white-space". Example:
"abc       def" is considered equal to "abc def", but not equal to
"abcdef".

--ignore-all-space: ignores all differences in white-space, including
between "having no white-space" and "having white-space". I.e. "abc
 def" is considered equal to "abcdef".

The above two only apply to white-space, not to eol-style, if I'm not
mistaken. So the --ignore-eol-style is orthogonal.

Can't you just use both options?
    svn diff / blame -x --ignore-space-change -x --ignore-eol-style

Or, with the short option for ignoring space-change:
    svn diff / blame -x-b -x--ignore-eol-style

(I generally prefer using --ignore-space-change instead of
--ignore-all-space, because the latter can hide really important
changes, which change the semantics e.g. in most programming languages
or xml files and such).

Cheers,
-- 
Johan

On Wed, Apr 20, 2011 at 8:03 PM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> AIUI, --ignore-eol-style + --ignore-space-change == --ignore-all-space.  It seems to me that --ignore-all-space would work for your use case?
>
> On Wed, 20 Apr 2011 20:44 +0300, "Stanimir Stamenkov" <s7...@netscape.net> wrote:
>> The '--ignore-space-change' option, and '--ignore-all-space' for
>> that matter, to the 'diff' and 'blame' commands doesn't seem to
>> ignore changes in the EOL style.  I really expect each of:
>>
>> --ignore-eol-style
>> --ignore-space-change
>> --ignore-all-space
>>
>> in the given order to include the effect of the previous one.  There
>> are many files which get initially created on Windows with CRLF
>> line-endings, but without the 'svn:eol-style=native' property set.
>> Then at some revision this property gets set and it gets very
>> difficult track/find the origin of past changes, onwards.  The
>> problem gets messier when the EOL style changes to LF and CRLF
>> number of times before the 'svn:eol-style' gets properly set.
>>
>> Now, one could think:
>>
>> svn diff / blame -x --ignore-eol-style ...
>>
>> should be sufficient.  But then often I need to use:
>>
>> svn diff / blame -x --ignore-space-change ...
>>
>> to ignore any space changes, e.g. changes to "tabs vs. spaces-only"
>> to the indentation (and elsewhere), which becomes impossible once
>> the file has changed the EOL style number of times.
>>
>> Is the current behavior of the space ignoring options intended, or
>> it appears omission?
>>
>> FWIW, I'm on Windows and I workaround the problem by having
>> installed the 'diff' command from the GnuWin32 [1] packages, which
>> doesn't seem to care about EOL style differences (treats them as equal):
>>
>> svn diff / blame --diff-cmd diff -x "--ignore-space-change ..." ...
>>
>> It would be really nice if the SVN default internal diff
>> implementation adds the effect of '--ignore-eol-style' to the
>> '--ignore-space-change' and '--ignore-all-space' options.
>>
>> [1] http://gnuwin32.sourceforge.net/
>>
>> --
>> Stanimir
>>
>

Re: svn diff / blame -x --ignore-space-change doesn't ignore EOL style changes

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
AIUI, --ignore-eol-style + --ignore-space-change == --ignore-all-space.  It seems to me that --ignore-all-space would work for your use case?

On Wed, 20 Apr 2011 20:44 +0300, "Stanimir Stamenkov" <s7...@netscape.net> wrote:
> The '--ignore-space-change' option, and '--ignore-all-space' for 
> that matter, to the 'diff' and 'blame' commands doesn't seem to 
> ignore changes in the EOL style.  I really expect each of:
> 
> --ignore-eol-style
> --ignore-space-change
> --ignore-all-space
> 
> in the given order to include the effect of the previous one.  There 
> are many files which get initially created on Windows with CRLF 
> line-endings, but without the 'svn:eol-style=native' property set. 
> Then at some revision this property gets set and it gets very 
> difficult track/find the origin of past changes, onwards.  The 
> problem gets messier when the EOL style changes to LF and CRLF 
> number of times before the 'svn:eol-style' gets properly set.
> 
> Now, one could think:
> 
> svn diff / blame -x --ignore-eol-style ...
> 
> should be sufficient.  But then often I need to use:
> 
> svn diff / blame -x --ignore-space-change ...
> 
> to ignore any space changes, e.g. changes to "tabs vs. spaces-only" 
> to the indentation (and elsewhere), which becomes impossible once 
> the file has changed the EOL style number of times.
> 
> Is the current behavior of the space ignoring options intended, or 
> it appears omission?
> 
> FWIW, I'm on Windows and I workaround the problem by having 
> installed the 'diff' command from the GnuWin32 [1] packages, which 
> doesn't seem to care about EOL style differences (treats them as equal):
> 
> svn diff / blame --diff-cmd diff -x "--ignore-space-change ..." ...
> 
> It would be really nice if the SVN default internal diff 
> implementation adds the effect of '--ignore-eol-style' to the 
> '--ignore-space-change' and '--ignore-all-space' options.
> 
> [1] http://gnuwin32.sourceforge.net/
> 
> -- 
> Stanimir
>