Hello Everyone,

 

If the end of an inserted block matches the end of the block preceding the
insert, then the output between "diff" and "diff3" is not the same. 

 

It looks like "diff" takes LCS from the end up, while "diff3" goes top down
which is more natural to the eye (see attached VS Code output, which matched
diff3). 

 

Is this a known issue, intended, or something that should be addressed?

 

Kind regards,

Marc

 

PS: This is based on diffutils 3.8 stable

 

mbtlinux:/sap/downloads # diff original.txt after_change.txt

6a7

>     METHODS test_3.

16a18,26

>     IF 1 = 2.

>       BREAK-POINT.

>     ENDIF.

>   ENDMETHOD.

> 

> 

> 

>   METHOD test_3.

>     "method 3

mbtlinux:/sap/downloads # diff3 original.txt original.txt after_change.txt

====3

1:6a

2:6a

3:7c

      METHODS test_3.

====3

1:21a

2:21a

3:23,31c

 

 

    METHOD test_3.

      "method 3

      IF 1 = 2.

        BREAK-POINT.

      ENDIF.

    ENDMETHOD.

 

mbtlinux:/sap/downloads #

REPORT ztest_diff_old.

CLASS lcl_test DEFINITION.
  PUBLIC SECTION.
    METHODS test_1.
    METHODS test_2.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.

  METHOD test_1.
    "comment
  ENDMETHOD.


  METHOD test_2.
    "comment
    IF 1 = 2.
      BREAK-POINT.
    ENDIF.
  ENDMETHOD.

ENDCLASS.
REPORT ztest_diff_old.

CLASS lcl_test DEFINITION.
  PUBLIC SECTION.
    METHODS test_1.
    METHODS test_2.
    METHODS test_3.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.

  METHOD test_1.
    "comment
  ENDMETHOD.


  METHOD test_2.
    "comment
    IF 1 = 2.
      BREAK-POINT.
    ENDIF.
  ENDMETHOD.



  METHOD test_3.
    "method 3
    IF 1 = 2.
      BREAK-POINT.
    ENDIF.
  ENDMETHOD.

ENDCLASS.
mbtlinux:/sap/downloads # diff -v
diff (GNU diffutils) 3.8
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
mbtlinux:/sap/downloads # diff original.txt after_change.txt
6a7
>     METHODS test_3.
16a18,26
>     IF 1 = 2.
>       BREAK-POINT.
>     ENDIF.
>   ENDMETHOD.
>
>
>
>   METHOD test_3.
>     "method 3
mbtlinux:/sap/downloads # diff3 original.txt original.txt after_change.txt
====3
1:6a
2:6a
3:7c
      METHODS test_3.
====3
1:21a
2:21a
3:23,31c


    METHOD test_3.
      "method 3
      IF 1 = 2.
        BREAK-POINT.
      ENDIF.
    ENDMETHOD.

mbtlinux:/sap/downloads # 

Reply via email to