anchor.diff:            ls_file-filename    = <ls_result>-filename.
             ls_file-is_changed  = boolc( NOT <ls_result>-match = abap_true ).
             ls_file-remote_only = <ls_result>-remote_only.
  -          APPEND ls_file TO ls_repo_item-files.
  +          APPEND ls_file TO <ls_repo_item>-files.
  +
  +          IF ls_file-is_changed = abap_true.
  +            <ls_repo_item>-sortkey = 2. " Changed files
  +          ENDIF.
           ENDIF.
   
           AT END OF obj_name. "obj_type + obj_name
  -          APPEND ls_repo_item TO et_repo_items.
  +          IF <ls_repo_item>-obj_type IS INITIAL.
  +            <ls_repo_item>-sortkey = 0. "Virtual objects
  +          ELSEIF lines( <ls_repo_item>-files ) = 0.
  +            <ls_repo_item>-sortkey = 1. "New object to commit
  +          ENDIF.
           ENDAT.
         ENDLOOP.
  -    ENDIF.
  +
  +      SORT et_repo_items BY sortkey obj_type obj_name ASCENDING.
  +      READ TABLE et_repo_items ASSIGNING <ls_repo_item> INDEX 1.
  +      IF sy-subrc IS INITIAL.
  +        <ls_repo_item>-is_first = abap_true.
  +      ENDIF.
  +    ENDIF.
  +
   
     ENDMETHOD.
   
  
positive.code:     IF io_repo->is_offline( ) = abap_true.
        lt_tadir = lcl_tadir=>read( io_repo->get_package( ) ).
        LOOP AT lt_tadir ASSIGNING <ls_tadir>.
          CLEAR ls_repo_item.
          IF sy-tabix = 1.
            ls_repo_item-is_first = abap_true.
          ENDIF.
          ls_repo_item-obj_type = <ls_tadir>-object.
          ls_repo_item-obj_name = <ls_tadir>-obj_name.
          APPEND ls_repo_item TO et_repo_items.
        ENDLOOP.
  
      ELSE.
  
negative.code: 
      DATA: lo_repo_online TYPE REF TO lcl_repo_online,
            lt_tadir       TYPE ty_tadir_tt,
            ls_file        TYPE ty_repo_file,
            lt_results     TYPE ty_results_tt.
  
      FIELD-SYMBOLS: <ls_result>    LIKE LINE OF lt_results,
                     <ls_repo_item> LIKE LINE OF et_repo_items,
                     <ls_tadir>     LIKE LINE OF lt_tadir.
  
  
      CLEAR et_repo_items.
  