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

ldiff unified/context outputs do not always include trailing context lines #95

Open
Math2 opened this issue Apr 12, 2024 · 0 comments
Open

Comments

@Math2
Copy link

Math2 commented Apr 12, 2024

$ cat > a
123
x
^D
$ cat > b
456
x
^D
$ ldiff -U 3 a b
--- a   2024-04-12 04:32:36.000000000 -0400
+++ b   2024-04-12 04:32:40.000000000 -0400
@@ -1 +1 @@
-123
+456
$ ldiff -C 3 a b
*** a   2024-04-12 04:32:36.000000000 -0400
--- b   2024-04-12 04:32:40.000000000 -0400
***************
*** 1 ****
! 123
--- 1 ----
! 456

The trailing "x" context line isn't there. But if you use "-U 1"/"-C 1", it'll be there.

The problem can be triggered by using Diff::LCS::Hunk directly too (and the amount of context lines you request with Diff::LCS::Hunk#initialize's 4th argument likewise affects if trailing context lines may be missing or not).

The amount of heading context lines for the hunk seem to affect if trailing lines may be missing or not too.

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

1 participant