Skip to content

Bug (!) in builderFiles2.cpp #43

@Ndolam

Description

@Ndolam

I was writing my own diff program (and setting that as Command.DiffFiles2),
but was running into some issues.

I traced them to this bit of code in createIgnoreBlock()

      else if ( filled2 ) {
         XxLine line( XxLine::SAME, ii1, -1 );
         line.setHunkId( _curHunk );
         addLine( line );
         ++ii1;
      }
      else if ( filled1 ) {
         XxLine line( XxLine::SAME, -1, ii2 );
         line.setHunkId( _curHunk );
         addLine( line );
         ++ii2;
      }

This code says "if line2 was good, save line1 and increase the index of line1" and vice versa.
I can only assume this block of code is rarely accessed if Command.DiffFiles2 is not set.

After changing filled2 to filled1 in the first block and vice versa in the second block, things started working for me.

If I am wrong about it being a bug, I'll be both embarrassed and mystified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions