Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdiff is breaking blocks #75

Closed
snoblenet opened this issue Apr 18, 2018 · 2 comments
Closed

cdiff is breaking blocks #75

snoblenet opened this issue Apr 18, 2018 · 2 comments

Comments

@snoblenet
Copy link

Let's say I have...

case: 'one';
  return 'yes, one';
  break;

...and I change it to...

case: 'one';
  return 'yes, one';
  break;
case: 'two';
  return 'yes, two';
  break;

...then git diff will correctly identify the change as...

case: 'two';
  return 'yes, two';
  break;

...but if I pipe git diff to cdiff, it shows the change as:

  break;
case: 'two';
  return 'yes, two';

How can I fix this? Thanks.

@snoblenet
Copy link
Author

To clarify, in the above minimal case, cdiff does actually work correctly.

But in a slightly more complex case designed to mimic real usage conditions, it fails in the way described above.

The slightly more complex case is...

Before:

case: 'one';
  return 'yes, one';
  break;
case: 'two';
  return 'yes, two';
  break;

After:

case: 'one';
  return 'yes, one';
  break;
case 'one-point-five';
  return 'yes, one-point-five';
  break;
case: 'two';
  return 'yes, two';
  break;

In that case git diff correctly identifies the added text as:

case 'one-point-five';
  return 'yes, one-point-five';
  break;

But when piped to cdiff, the change is presented as:

  break;
case 'one-point-five';
  return 'yes, one-point-five';

@snoblenet snoblenet reopened this Apr 18, 2018
@ymattw
Copy link
Owner

ymattw commented Apr 20, 2018

It's a behavior of python difflib, which is slightly different to git/svn diff and patchutils, I imagine enhancing this requires to touch core diff algorithm in difflib. I agree it's confusing but IMHO not worth to "fix" as the diff format is still right. Thanks for reporting!

@ymattw ymattw closed this as completed Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants