@@ -80,8 +80,8 @@ static int git_commit__create_buffer_internal(
8080}
8181
8282static int validate_tree_and_parents (git_array_oid_t * parents , git_repository * repo , const git_oid * tree ,
83- git_commit_parent_callback parent_cb , void * parent_payload ,
84- const git_oid * current_id , bool validate )
83+ git_commit_parent_callback parent_cb , void * parent_payload ,
84+ const git_oid * current_id , bool validate )
8585{
8686 size_t i ;
8787 int error ;
@@ -152,8 +152,8 @@ static int git_commit__create_internal(
152152 goto cleanup ;
153153
154154 error = git_commit__create_buffer_internal (& buf , author , committer ,
155- message_encoding , message , tree ,
156- & parents );
155+ message_encoding , message , tree ,
156+ & parents );
157157
158158 if (error < 0 )
159159 goto cleanup ;
@@ -582,7 +582,7 @@ const char *git_commit_body(git_commit *commit)
582582 break ;
583583
584584 if (* msg )
585- commit -> body = git__strndup (msg , end - msg + 1 );
585+ commit -> body = git__strndup (msg , end - msg + 1 );
586586 }
587587
588588 return commit -> body ;
@@ -876,12 +876,15 @@ int git_commit_create_with_signature(
876876 return -1 ;
877877 }
878878
879- field = signature_field ? signature_field : "gpgsig" ;
880-
881879 /* The header ends after the first LF */
882880 header_end ++ ;
883881 git_buf_put (& commit , commit_content , header_end - commit_content );
884- format_header_field (& commit , field , signature );
882+
883+ if (signature != NULL ) {
884+ field = signature_field ? signature_field : "gpgsig" ;
885+ format_header_field (& commit , field , signature );
886+ }
887+
885888 git_buf_puts (& commit , header_end );
886889
887890 if (git_buf_oom (& commit ))
0 commit comments