Package: diffstat
Version: 1.53-1
Severity: normal
Tags: upstream patch

Hi!

diffstat in both squeeze and sid doesn't handle svn diff output nicely if
there are spaces in the file path. I guess that's probably considered just
punishment for creating files or directories with spaces in them... but it
does make the output of diffstat somewhat less useful.

The attached example illustrates the problem:

$ diffstat svn_diff_example 
 ergh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

and the attached patch (against 1.55-2 and suitable for debian/patches/)
fixes this:

$ diffstat svn_diff_example 
 quux bar baz  |    2 +-
 quux bar baz2 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

cheers
Stuart

-- System Information:
Debian Release: 6.0.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-0.bpo.2-686-pae (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages diffstat depends on:
ii  libc6                         2.11.3-3   Embedded GNU C Library: Shared lib

diffstat recommends no packages.

diffstat suggests no packages.

-- no debconf information
Index: ergh eek arf/quux bar baz
===================================================================
--- ergh eek arf/quux bar baz	(.../branch1)	(revision 4)
+++ ergh eek arf/quux bar baz	(.../branch2)	(revision 4)
@@ -1 +1 @@
-foo goo
+foo bar
Index: ergh eek arf/quux bar baz2
===================================================================
--- ergh eek arf/quux bar baz2	(.../branch1)	(revision 4)
+++ ergh eek arf/quux bar baz2	(.../branch2)	(revision 4)
@@ -1 +1 @@
-foo goo
+foo bar
Description: Handle pathnames with spaces in svn diff format
Author: Stuart Prescott <stuart+deb...@nanonanonano.net>

--- a/diffstat.c
+++ b/diffstat.c
@@ -1444,6 +1444,10 @@
                               &hour, &minute, &second) == 9
                        && date_delims(yrmon, monday)
                        && !version_num(b_fname))
+                   || (sscanf(buffer,
+                              "*** %[^\t]\t(%[^)])\t(%[^)])",
+                              b_fname, b_temp1, b_temp2) == 3
+                       && !version_num(b_fname))
                    || sscanf(buffer,
                              "*** %[^\t ]%[\t ]%[^ ] %[^ ] %d %d:%d:%d %d",
                              b_fname,

Reply via email to