From 53dec3d2e8edaa3e0bdc1bffb00277be1a109bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=BCnter?= Date: Mon, 31 May 2021 07:47:30 +0200 Subject: [PATCH] Improve secondary key access (#4801) --- src/git/zcl_abapgit_git_branch_list.clas.abap | 9 ++++++--- .../zcl_abapgit_git_branch_list.clas.testclasses.abap | 4 +++- src/zcl_abapgit_branch_overview.clas.abap | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/git/zcl_abapgit_git_branch_list.clas.abap b/src/git/zcl_abapgit_git_branch_list.clas.abap index 33b1f0230..b54a07ebf 100644 --- a/src/git/zcl_abapgit_git_branch_list.clas.abap +++ b/src/git/zcl_abapgit_git_branch_list.clas.abap @@ -127,7 +127,8 @@ CLASS zcl_abapgit_git_branch_list IMPLEMENTATION. ELSE. READ TABLE mt_branches INTO rs_branch - WITH KEY name = iv_branch_name. + WITH TABLE KEY name_key + COMPONENTS name = iv_branch_name. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Branch { get_display_name( iv_branch_name ) } not found. Use 'Branch' > 'Switch' to select a different branch| ). @@ -145,11 +146,13 @@ CLASS zcl_abapgit_git_branch_list IMPLEMENTATION. lv_branch_name = iv_branch_name && '^{}'. READ TABLE mt_branches INTO rs_branch - WITH KEY name = lv_branch_name. + WITH TABLE KEY name_key + COMPONENTS name = lv_branch_name. IF sy-subrc <> 0. READ TABLE mt_branches INTO rs_branch - WITH KEY name = iv_branch_name. + WITH TABLE KEY name_key + COMPONENTS name = iv_branch_name. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Branch not found' ). ENDIF. diff --git a/src/git/zcl_abapgit_git_branch_list.clas.testclasses.abap b/src/git/zcl_abapgit_git_branch_list.clas.testclasses.abap index a6d3cb0bd..660a148eb 100644 --- a/src/git/zcl_abapgit_git_branch_list.clas.testclasses.abap +++ b/src/git/zcl_abapgit_git_branch_list.clas.testclasses.abap @@ -45,7 +45,9 @@ CLASS ltcl_parse IMPLEMENTATION. act = lines( lt_list ) exp = iv_expected_lines ). - READ TABLE lt_list WITH KEY name = zif_abapgit_definitions=>c_git_branch-main TRANSPORTING NO FIELDS. + READ TABLE lt_list WITH TABLE KEY name_key + COMPONENTS name = zif_abapgit_definitions=>c_git_branch-main + TRANSPORTING NO FIELDS. cl_abap_unit_assert=>assert_subrc( ). ENDMETHOD. diff --git a/src/zcl_abapgit_branch_overview.clas.abap b/src/zcl_abapgit_branch_overview.clas.abap index 3f96fbc34..a09295b3e 100644 --- a/src/zcl_abapgit_branch_overview.clas.abap +++ b/src/zcl_abapgit_branch_overview.clas.abap @@ -132,7 +132,8 @@ CLASS zcl_abapgit_branch_overview IMPLEMENTATION. * Exchange HEAD, and make sure the branch determination starts with the HEAD branch - READ TABLE mt_branches ASSIGNING WITH KEY name = lc_head. + READ TABLE mt_branches ASSIGNING + WITH TABLE KEY name_key COMPONENTS name = lc_head. ASSERT sy-subrc = 0. LOOP AT mt_branches ASSIGNING WHERE sha1 = -sha1 AND name <> lc_head.