Comment 1 for bug 71307

Revision history for this message
John A Meinel (jameinel) wrote : Re: "bzr diff" produces silly result for added binary file

Confirmed. The specifics are that:

1) To get the timestamp as part of the output, we actually cheat, and change the filename. So to get:
--- lib/canonical/foo 2005-01-02 ...
+++ lib/canonical/foo 2006-11-09 ...

 we actually change the name of the file from 'lib/canonical/foo' to 'lib/canonical/foo' to 'lib/canonical/foo 2005-01-02 ...'
We really should have a separate parameter that we pass, so we don't get weird things later.

2) 1970 is the date of the epoch, and it is the date that diff uses when it is trying to say 'no such file'.
At one point we didn't have datestamps. Somebody asked for them because they worked better. And they also asked us to not use /dev/null, and instead use the filename.

Specifically, you can do:
$ mkdir a; echo foo > a/foo; mkdir b
$ diff -urN a b
--- a/foo 2007-01-03 15:35:10.000000000 -0600
+++ b/foo 1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-foo

I was surprised to see 'diff' use 1970 adjusted for the local time zone, but regardless that seems to be the "standard" output.

I personally don't really like the datestamps, but if someone finds them useful...

So I would argue that we do need to fix the code to use the real filenames, separate from the datestamps. I'm not sure what to do exactly for the rest.