Possible bug in bzr diff

Wayne Davison wayned at samba.org
Fri Apr 21 04:10:36 BST 2006


On Tue, Mar 21, 2006 at 07:48:32PM +0000, Goffredo Baroncelli wrote:
> If a file is changed _AND_ is moved or an entry of its path is
> renamed, the diff is wrong:

Because diff's output is currently inconsistent with itself, it seems
to me that this should get fixed.

Here's an example that demonstrates how the diff headers appear for a
renamed file inside a renamed dir, and an unrenamed file inside a
renamed dir.  Note that the former refers to the directory by its old
name in the "a" header, while the latter refers to it by its new name.

    % bzr init
    % mkdir dir
    % echo line-1 >dir/foo
    % bzr add
    added dir
    added dir/foo
    % bzr commit -m testing
    added dir
    added dir/foo
    Committed revision 1.
    % echo appended >>dir/foo
    % bzr mv dir/foo dir/bar
    dir/foo => dir/bar
    % bzr mv dir dir2
    dir => dir2
    % bzr diff
    === renamed directory 'a/dir' => 'b/dir2'
    === renamed file 'a/dir/foo' => 'b/dir2/bar'
    --- a/dir/foo
    +++ b/dir2/bar
    @@ -1,1 +1,2 @@
     line-1
    +appended
    
    % bzr mv dir2/bar dir2/foo
    dir2/bar => dir2/foo
    % bzr diff
    === renamed directory 'a/dir' => 'b/dir2'
    === modified file 'a/dir2/foo'
    --- a/dir2/foo
    +++ b/dir2/foo
    @@ -1,1 +1,2 @@
     line-1
    +appended
    

It seems like the easiest fix would be to change the latter case to output
"a/dir/foo", as suggested in Goffredo's patch.

..wayne..




More information about the bazaar mailing list