Patch #1476
Ignore whitespace when using SVN (requires installation of gnu diff)
| Status: | New | Start date: | 2008-06-16 | |
|---|---|---|---|---|
| Priority: | Normal | Due 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.
Related issues
History
#1 Updated by Toshi MARUYAMA over 2 years ago
- Category set to SCM
#2 Updated by Enrique Garcia about 2 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 4 months 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 "
