diff --git a/src/zabapgit_repo.prog.abap b/src/zabapgit_repo.prog.abap index 0f07cdfa4..131144ca6 100644 --- a/src/zabapgit_repo.prog.abap +++ b/src/zabapgit_repo.prog.abap @@ -147,6 +147,9 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL. initialize RAISING lcx_exception, actualize_head_branch + RAISING lcx_exception, + delete_initial_online_repo + importing iv_commit type flag RAISING lcx_exception. ENDCLASS. "lcl_repo_online DEFINITION diff --git a/src/zabapgit_repo_impl.prog.abap b/src/zabapgit_repo_impl.prog.abap index ef402633c..eaedd802a 100644 --- a/src/zabapgit_repo_impl.prog.abap +++ b/src/zabapgit_repo_impl.prog.abap @@ -72,6 +72,8 @@ CLASS lcl_repo_online IMPLEMENTATION. METHOD refresh. + DATA: lx_exception TYPE REF TO lcx_exception. + super->refresh( iv_drop_cache ). reset_status( ). @@ -80,10 +82,20 @@ CLASS lcl_repo_online IMPLEMENTATION. iv_total = 1 iv_text = 'Remote files' ) ##NO_TEXT. - lcl_git_porcelain=>pull( EXPORTING io_repo = me - IMPORTING et_files = mt_remote - et_objects = mt_objects - ev_branch = mv_branch ). + TRY. + + lcl_git_porcelain=>pull( EXPORTING io_repo = me + IMPORTING et_files = mt_remote + et_objects = mt_objects + ev_branch = mv_branch ). + + CATCH lcx_exception INTO lx_exception. + + delete_initial_online_repo( abap_true ). + + RAISE EXCEPTION lx_exception. + + ENDTRY. mo_branches = lcl_git_transport=>branches( get_url( ) ). actualize_head_branch( ). @@ -295,6 +307,20 @@ CLASS lcl_repo_online IMPLEMENTATION. ENDMETHOD. " rebuild_local_checksums. + METHOD delete_initial_online_repo. + + IF me->is_offline( ) = abap_false AND me->get_sha1_local( ) IS INITIAL. + + lcl_app=>repo_srv( )->delete( me ). + + IF iv_commit = abap_true. + COMMIT WORK. + ENDIF. + + ENDIF. + + ENDMETHOD. " delete_initial_online_repo + ENDCLASS. "lcl_repo_online IMPLEMENTATION *----------------------------------------------------------------------*