larshp / abapGitServer

Git server implemented in ABAP
MIT License
64 stars 25 forks source link

Signed commits from GitHub UI #137

Closed germanysources closed 3 years ago

germanysources commented 4 years ago

Commits created with GitHub UI causes a runtime error. Steps to reproduce:

The hash calculated by GitHub and the hash calculated by abapGitServer doesn't match. It fails in method zcl_ags_pack=>save

  METHOD save.

    DATA: li_object TYPE REF TO zif_ags_object.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF it_objects.

    ASSERT NOT iv_repo IS INITIAL.

    LOOP AT it_objects ASSIGNING <ls_object>.
      CASE <ls_object>-type.
        WHEN zif_ags_constants=>c_type-blob.
          li_object = zcl_ags_obj_blob=>new( iv_repo ).
        WHEN zif_ags_constants=>c_type-tree.
          li_object = zcl_ags_obj_tree=>new( iv_repo ).
        WHEN zif_ags_constants=>c_type-commit.
          li_object = zcl_ags_obj_commit=>new( iv_repo ).
        WHEN OTHERS.
          RAISE EXCEPTION TYPE zcx_ags_error
            EXPORTING
              textid = zcx_ags_error=>m009.
      ENDCASE.

      li_object->deserialize( iv_data    = <ls_object>-data
                              iv_adler32 = <ls_object>-adler32 ).

      ASSERT li_object->get_sha1( ) = <ls_object>-sha1. " doesn't match

      li_object->save( ).

    ENDLOOP.

  ENDMETHOD.

The SHA1 created by GitHub contains the public GPG-key as you can see with the command (printf "commit %s\0" $(git cat-file commit HEAD | wc -c); git cat-file commit HEAD). abapGitServer ignores the public GPG-key.

larshp commented 4 years ago

GitHub UI? does it reproduce via command line git?

germanysources commented 4 years ago

If you sign a commit with a GPG-key, the error occurs in command line git, too.