Hi
I think I have found a bug with diff when context is greater then zero.
I have included the two files and the diff file produced.
This diff file has been generated with version 2.7 running on Windows 7.
The same behavior have been noticed with version 3.3 running on linux.
My command was diff -C 2 original.txt modified.txt
Now looking on the produced diff file, I had two additions. At the
beggining and at the end of my modified file.
*** Original.txt Sat May 28 09:07:08 2016
--- Modified.txt Sat May 28 09:07:18 2016
***************
*** 1,2 ****
--- 1,8 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!
+
This part of the
document has stayed the
***************
*** 6,20 ****
change. Otherwise, that
would not be helping to
! compress the size of the
! changes.
!
! This paragraph contains
! text that is outdated.
! It will be deleted in the
! near future.
allo
It is important to spell
! check this dokument. On
the other hand, a
misspelled word isn't
--- 12,20 ----
change. Otherwise, that
would not be helping to
! compress anything.
allo
It is important to spell
! check this document. On
the other hand, a
misspelled word isn't
***************
*** 24,25 ****
--- 24,29 ----
be changed. Things can
be added after it.
+
+ This paragraph contains
+ important new additions
+ to this document.
Notice that on the original file diff specifies that it will list
context lines content 1,2 for the
beginning and 24,25 for the end, but the lines are not displayed in the
diff block description.
The two context lines appear for the modified files for the same
differences though.
Also, the two context lines are displayed, at top, and at bottom when
differences occure in the middle of the file.
I have no corrections for this bug. I haven't looked at the code.
Thanks
This part of the
document has stayed the
same from version to
version. It shouldn't
be shown if it doesn't
change. Otherwise, that
would not be helping to
compress the size of the
changes.
This paragraph contains
text that is outdated.
It will be deleted in the
near future.
allo
It is important to spell
check this dokument. On
the other hand, a
misspelled word isn't
the end of the world.
Nothing in the rest of
this paragraph needs to
be changed. Things can
be added after it.
*** Original.txt Sat May 28 09:07:08 2016
--- Modified.txt Sat May 28 09:07:18 2016
***************
*** 1,2 ****
--- 1,8 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!
+
This part of the
document has stayed the
***************
*** 6,20 ****
change. Otherwise, that
would not be helping to
! compress the size of the
! changes.
!
! This paragraph contains
! text that is outdated.
! It will be deleted in the
! near future.
allo
It is important to spell
! check this dokument. On
the other hand, a
misspelled word isn't
--- 12,20 ----
change. Otherwise, that
would not be helping to
! compress anything.
allo
It is important to spell
! check this document. On
the other hand, a
misspelled word isn't
***************
*** 24,25 ****
--- 24,29 ----
be changed. Things can
be added after it.
+
+ This paragraph contains
+ important new additions
+ to this document.
This is an important
notice! It should
therefore be located at
the beginning of this
document!
This part of the
document has stayed the
same from version to
version. It shouldn't
be shown if it doesn't
change. Otherwise, that
would not be helping to
compress anything.
allo
It is important to spell
check this document. On
the other hand, a
misspelled word isn't
the end of the world.
Nothing in the rest of
this paragraph needs to
be changed. Things can
be added after it.
This paragraph contains
important new additions
to this document.