[PATCH] patiencediff.py/unified_diff: do not insert trailing whitespace if filedate is empty

Adeodato Simó dato at net.com.org.es
Tue Jan 6 10:40:31 GMT 2009


* John Arbash Meinel [Mon, 05 Jan 2009 14:26:10 -0600]:

> I know we ran into problems elsewhere, like needing to use a real tab
> (\t) character rather than just a space character in other parts of the
> diff header.

The \t character is needed precisely between the file name, and the date
(see bzrlib/diff.py). In that regard, both difflib and patiencediff.py
would be wrong by using a space.

> I'm not sure, but there may be programs that expect a trailing blank space.

I'd doubt it. FWIW, other tools like git and quilt don't print a
trailing blank space (nor tab) when they don't include a timestamp.

> So I'm tempted to reject this change, in favor of updating
> colordiff.DiffWriter to allow trailing whitespace on lines starting with
> "+++ "

I'd be fine with this as well, sure.

Though I believe my fix to be correct (if it ends up being applied, you
could make it use '\t' rather than ' ' while we're at it).

> I can certainly be convinced otherwise, but since difflib.unified_diff()
> produces the same output as our current output, I hesitate to change it.

Heh, maybe I'll propose the same patch for difflib if I get around to
it. OTOH, if this line of yours is about /compatibility/ and not
correctness, it's going to be more difficult to get you convinced. :-)

Thanks, John. As said, the change to DiffWriter would be fine with me if
that's what you prefer.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Excuse me for thinking a banana-eating contest was about eating a banana!
                -- Paris Geller




More information about the bazaar mailing list