Patch #1476

Ignore whitespace when using SVN (requires installation of gnu diff)

Added by Chris Peterson about 11 years ago. Updated about 5 years ago.

Status:NewStart date:2008-06-16
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-

Description

If gnu diff is installed, this will ignore white space differences when doing a difference view between two revisions.

svn_no_whitespace_diff.patch Magnifier (804 Bytes) Chris Peterson, 2008-06-16 21:27


Related issues

Related to Redmine - Feature #9853: As a code inspector/reviewer, I would like to be able to ... New
Related to Redmine - Feature #11414: Ignore whitespace when using GIT New

History

#1 Updated by Toshi MARUYAMA over 8 years ago

  • Category set to SCM

#2 Updated by Enrique Garcia about 8 years ago

Since this patch was released, subversion gained white-spacing ignoring habilities (to be precise, v1.4 onwards support this) so there's a way of doing this without relying on having the diff program installed.

Locate the following line of the diff method inside /lib/redmine/scm/adapters/subversion.rb:

cmd = "#{SVN_BIN} diff -r " 

And replace it with this one:

cmd = "#{SVN_BIN} diff -x '--ignore-all-space --ignore-eol-style' -r " 

The single quotes after -x are intentional. The space after -r is also important.

You can customize the way the spaces are ignored by changing the options passed to -x ; type svn diff help on the console and look under the -x option for more info.

#3 Updated by Charles Sporkman over 6 years ago

Just wanted to throw in my $0.02 and note this is really necessary to make casual diff-ing useful. Just brought in some code that had weird whitespace changes and windows line endings. The redmine diff was totally useless in that instance.

What has to happen to commit this? Do we need a patch to add a "ignore whitespace" toggle in the repo view?

On 2.2.2, this is what the command looks like:

cmd = "#{self.class.sq_bin} diff -x '--ignore-all-space --ignore-eol-style' -r "

#4 Updated by Mathias Fischer about 5 years ago

+1 but should be optional per repository like in #11414 mentioned

Also available in: Atom PDF