diff --git a/docs/guide-settings-global.md b/docs/guide-settings-global.md index c294e2ce9..260f0cb3f 100644 --- a/docs/guide-settings-global.md +++ b/docs/guide-settings-global.md @@ -30,6 +30,8 @@ to 50/72 according to the "[Rule of Well Formed Git Commit Messages](https://www You can also maintain a default for the comment. Variables $OBJECT and $FILE will be replaced by the number of objects or files contained in the commit. +By default, the [commit page](https://docs.abapgit.org/guide-stage-commit.html#commit) contains fields for "Author Name" and "Author Email" which you can enter in case they are different from the committer. If the author is always the same as the committer, these fields are not required and you can use the "Hide Author Fields" option to remove them from on the commit page. + ## Development Internal Settings Note: These settings are only available when using the [Development Version](https://docs.abapgit.org/guide-development-version.html) of abapGit. diff --git a/docs/img/settings-global-2.png b/docs/img/settings-global-2.png index 9e0da41ea..b5244d441 100644 Binary files a/docs/img/settings-global-2.png and b/docs/img/settings-global-2.png differ diff --git a/src/ui/zcl_abapgit_gui_page_commit.clas.abap b/src/ui/zcl_abapgit_gui_page_commit.clas.abap index 0bc2a6f70..296ac41a2 100644 --- a/src/ui/zcl_abapgit_gui_page_commit.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_commit.clas.abap @@ -122,6 +122,12 @@ ENDCLASS. CLASS zcl_abapgit_gui_page_commit IMPLEMENTATION. + METHOD branch_name_to_internal. + rv_new_branch_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name( + zcl_abapgit_git_branch_list=>normalize_branch_name( iv_branch_name ) ). + ENDMETHOD. + + METHOD constructor. super->constructor( ). @@ -320,15 +326,19 @@ CLASS zcl_abapgit_gui_page_commit IMPLEMENTATION. )->text( iv_name = c_id-committer_email iv_label = 'Committer Email' - iv_required = abap_true - )->text( - iv_name = c_id-author_name - iv_label = 'Author Name' - iv_placeholder = 'Optionally, specify an author (same as committer by default)' - )->text( - iv_name = c_id-author_email - iv_label = 'Author Email' - )->text( + iv_required = abap_true ). + + IF mo_settings->get_commitmsg_hide_author( ) IS INITIAL. + ro_form->text( + iv_name = c_id-author_name + iv_label = 'Author Name' + iv_placeholder = 'Optionally, specify an author (same as committer by default)' + )->text( + iv_name = c_id-author_email + iv_label = 'Author Email' ). + ENDIF. + + ro_form->text( iv_name = c_id-new_branch_name iv_label = 'New Branch Name' iv_placeholder = 'Optionally, enter a new branch name for this commit' @@ -557,10 +567,4 @@ CLASS zcl_abapgit_gui_page_commit IMPLEMENTATION. ri_html->add( '' ). ENDMETHOD. - - METHOD branch_name_to_internal. - rv_new_branch_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name( - zcl_abapgit_git_branch_list=>normalize_branch_name( iv_branch_name ) ). - ENDMETHOD. - ENDCLASS. diff --git a/src/ui/zcl_abapgit_gui_page_sett_glob.clas.abap b/src/ui/zcl_abapgit_gui_page_sett_glob.clas.abap index c087c4d72..96b0543cb 100644 --- a/src/ui/zcl_abapgit_gui_page_sett_glob.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_sett_glob.clas.abap @@ -32,6 +32,7 @@ CLASS zcl_abapgit_gui_page_sett_glob DEFINITION commitmsg_comment_length TYPE string VALUE 'commitmsg_comment_length', commitmsg_comment_deflt TYPE string VALUE 'commitmsg_comment_deflt', commitmsg_body_size TYPE string VALUE 'commitmsg_body_size', + commitmsg_hide_author TYPE string VALUE 'commitmsg_hide_author', devint_settings TYPE string VALUE 'devint_settings', run_critical_tests TYPE string VALUE 'run_critical_tests', experimental_features TYPE string VALUE 'experimental_features', @@ -76,7 +77,7 @@ ENDCLASS. -CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_GLOB IMPLEMENTATION. +CLASS zcl_abapgit_gui_page_sett_glob IMPLEMENTATION. METHOD constructor. @@ -153,7 +154,10 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_GLOB IMPLEMENTATION. iv_required = abap_true iv_label = 'Maximum Line Size of Body' iv_hint = |At least { zcl_abapgit_settings=>c_commitmsg_body_size_dft } characters| - iv_min = zcl_abapgit_settings=>c_commitmsg_body_size_dft ). + iv_min = zcl_abapgit_settings=>c_commitmsg_body_size_dft + )->checkbox( + iv_name = c_id-commitmsg_hide_author + iv_label = 'Hide Author Fields' ). IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false. ro_form->start_group( @@ -225,6 +229,9 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_GLOB IMPLEMENTATION. mo_form_data->set( iv_key = c_id-commitmsg_body_size iv_val = |{ mo_settings->get_commitmsg_body_size( ) }| ). + mo_form_data->set( + iv_key = c_id-commitmsg_hide_author + iv_val = boolc( mo_settings->get_commitmsg_hide_author( ) = abap_true ) ) ##TYPE. " Dev Internal IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false. @@ -285,6 +292,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_GLOB IMPLEMENTATION. mo_settings->set_commitmsg_comment_default( mo_form_data->get( c_id-commitmsg_comment_deflt ) ). lv_value = mo_form_data->get( c_id-commitmsg_body_size ). mo_settings->set_commitmsg_body_size( lv_value ). + mo_settings->set_commitmsg_hide_author( boolc( mo_form_data->get( c_id-commitmsg_hide_author ) = abap_true ) ). " Dev Internal IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false. diff --git a/src/zcl_abapgit_settings.clas.abap b/src/zcl_abapgit_settings.clas.abap index 055d2b8a3..8493aeda0 100644 --- a/src/zcl_abapgit_settings.clas.abap +++ b/src/zcl_abapgit_settings.clas.abap @@ -85,6 +85,12 @@ CLASS zcl_abapgit_settings DEFINITION METHODS get_commitmsg_body_size RETURNING VALUE(rv_length) TYPE i . + METHODS set_commitmsg_hide_author + IMPORTING + !iv_hide_author TYPE abap_bool. + METHODS get_commitmsg_hide_author + RETURNING + VALUE(rv_hide_author) TYPE abap_bool. METHODS get_settings_xml RETURNING VALUE(rv_settings_xml) TYPE string @@ -162,6 +168,7 @@ CLASS zcl_abapgit_settings DEFINITION commitmsg_comment_length TYPE i, commitmsg_comment_deflt TYPE string, commitmsg_body_size TYPE i, + commitmsg_hide_author TYPE abap_bool, END OF ty_s_settings. DATA: ms_settings TYPE ty_s_settings, @@ -202,6 +209,11 @@ CLASS zcl_abapgit_settings IMPLEMENTATION. ENDMETHOD. + METHOD get_commitmsg_hide_author. + rv_hide_author = ms_settings-commitmsg_hide_author. + ENDMETHOD. + + METHOD get_experimental_features. rv_run = ms_settings-experimental_features. ENDMETHOD. @@ -339,6 +351,11 @@ CLASS zcl_abapgit_settings IMPLEMENTATION. ENDMETHOD. + METHOD set_commitmsg_hide_author. + ms_settings-commitmsg_hide_author = iv_hide_author. + ENDMETHOD. + + METHOD set_defaults. CLEAR ms_settings.