Commit page: option to hide author fields (#5171)

* Commit page: option to hide author fields

The vast majority of time the committer is the same as the author (I assume). This adds an option to hide the author name and email fields on the commit form.

* Update docs

* Update docs

Co-authored-by: Christian Günter <christianguenter@googlemail.com>
This commit is contained in:
Marc Bernard 2021-12-01 09:27:30 -05:00 committed by GitHub
parent b512f6477a
commit 29a9201a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 17 deletions

View File

@ -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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -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( '</div>' ).
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.

View File

@ -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.

View File

@ -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.