Checkout commit: Improve error message (#4793)

Checkout commit: Improve error message.
Checking out commits is currently limited to branches with less than 99 commits. If this limit is reached a message appears saying 'No commits are available in this branch.'.
After this commit is applied the error message is 'Cannot find initial commit. Too many commits. Action not possible.'.
This commit is contained in:
Christian Günter 2021-05-27 14:54:56 +02:00 committed by GitHub
parent f710d368e5
commit 1fa51e7c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,9 @@ CLASS zcl_abapgit_git_commit DEFINITION
zcx_abapgit_exception . zcx_abapgit_exception .
CLASS-METHODS sort_commits CLASS-METHODS sort_commits
CHANGING CHANGING
!ct_commits TYPE zif_abapgit_definitions=>ty_commit_tt . !ct_commits TYPE zif_abapgit_definitions=>ty_commit_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS reverse_sort_order CLASS-METHODS reverse_sort_order
CHANGING CHANGING
!ct_commits TYPE zif_abapgit_definitions=>ty_commit_tt . !ct_commits TYPE zif_abapgit_definitions=>ty_commit_tt .
@ -239,7 +241,9 @@ CLASS zcl_abapgit_git_commit IMPLEMENTATION.
" find initial commit " find initial commit
READ TABLE ct_commits ASSIGNING <ls_initial_commit> WITH KEY parent1 = space. READ TABLE ct_commits ASSIGNING <ls_initial_commit> WITH KEY parent1 = space.
IF sy-subrc = 0. IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Cannot find initial commit. Too many commits. Action not possible.| ).
ENDIF.
ls_parent-sign = 'I'. ls_parent-sign = 'I'.
ls_parent-option = 'EQ'. ls_parent-option = 'EQ'.
@ -263,7 +267,6 @@ CLASS zcl_abapgit_git_commit IMPLEMENTATION.
INSERT ls_next_commit INTO TABLE lt_sorted_commits. INSERT ls_next_commit INTO TABLE lt_sorted_commits.
ENDDO. ENDDO.
ENDIF.
ct_commits = lt_sorted_commits. ct_commits = lt_sorted_commits.
ENDMETHOD. ENDMETHOD.