file status, bugfix (#5220)

closes #5219
This commit is contained in:
Lars Hvam 2021-12-14 17:56:26 +01:00 committed by GitHub
parent dc51247e9b
commit 7d5d1cabca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 8 deletions

View File

@ -142,7 +142,7 @@ ENDCLASS.
CLASS zcl_abapgit_file_status IMPLEMENTATION.
CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION.
METHOD build_existing.
@ -710,6 +710,7 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION.
WITH KEY path = <ls_remote>-path filename = <ls_remote>-filename
BINARY SEARCH.
IF sy-subrc = 0.
<ls_result>-match = abap_false.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.

View File

@ -686,6 +686,9 @@ CLASS ltcl_calculate_status DEFINITION FOR TESTING RISK LEVEL HARMLESS
METHODS:
setup,
complete_local,
complete_remote,
complete_state,
only_remote FOR TESTING RAISING zcx_abapgit_exception,
only_local FOR TESTING RAISING zcx_abapgit_exception,
match FOR TESTING RAISING zcx_abapgit_exception,
@ -693,10 +696,8 @@ CLASS ltcl_calculate_status DEFINITION FOR TESTING RISK LEVEL HARMLESS
moved FOR TESTING RAISING zcx_abapgit_exception,
local_outside_main FOR TESTING RAISING zcx_abapgit_exception,
complete FOR TESTING RAISING zcx_abapgit_exception,
complete_local,
complete_remote,
complete_state,
deleted_remotely FOR TESTING RAISING zcx_abapgit_exception.
only_local2 FOR TESTING RAISING zcx_abapgit_exception,
only_remote2 FOR TESTING RAISING zcx_abapgit_exception.
ENDCLASS.
@ -1137,7 +1138,7 @@ CLASS ltcl_calculate_status IMPLEMENTATION.
ENDMETHOD.
METHOD deleted_remotely.
METHOD only_local2.
mo_helper->add_local(
iv_path = '/src/'
@ -1155,8 +1156,44 @@ CLASS ltcl_calculate_status IMPLEMENTATION.
" it should appear as deleted remotely
cl_abap_unit_assert=>assert_equals(
act = mo_result->get_line( 1 )-rstate
exp = zif_abapgit_definitions=>c_state-deleted ).
act = mo_result->get_line( 1 )-lstate
exp = zif_abapgit_definitions=>c_state-added ).
ENDMETHOD.
METHOD only_remote2.
mo_helper->add_local(
iv_path = '/src/sub/'
iv_obj_name = 'ZCL_CLAS'
iv_obj_type = 'CLAS'
iv_filename = 'zcl_clas.clas.abap'
iv_sha1 = '112233' ).
mo_helper->add_remote(
iv_path = '/src/sub/'
iv_filename = 'zcl_clas.clas.abap'
iv_sha1 = '332211' ).
mo_helper->add_remote(
iv_path = '/src/sub/'
iv_filename = 'zcl_clas.clas.locals_imp.abap'
iv_sha1 = '1111' ).
mo_helper->add_state(
iv_path = '/src/sub/'
iv_filename = 'zcl_clas.clas.locals_imp.abap'
iv_sha1 = '1111' ).
mo_result = mo_helper->run( iv_devclass = '$DIFFERENT$' ).
mo_result->assert_lines( 2 ).
cl_abap_unit_assert=>assert_equals(
act = mo_result->get_line( 2 )-match
exp = abap_false ).
ENDMETHOD.
ENDCLASS.