Add support for creating signed commits and signing commits during a rebase #626

Merged
mbfr merged 25 commits from master into master 2020-08-18 11:25:31 -05:00
2 changed files with 8 additions and 0 deletions
Showing only changes of commit a94318f919 - Show all commits

View File

@ -3,6 +3,7 @@ package git
/*
#include <git2.h>
extern void _go_git_buf_fill_null(git_buf *buf);
extern void _go_git_populate_commit_sign_cb(git_rebase_options *opts);
*/
import "C"
@ -102,6 +103,8 @@ func commitSignCallback(_signature *C.git_buf, _signature_field *C.git_buf, _com
return errors.New("could not grow buffer")
}
C._go_git_buf_fill_null(buf)
lhchavez commented 2020-08-14 08:59:06 -05:00 (Migrated from github.com)
Review

this needs a C.free(...).

this needs a `C.free(...)`.
mbfr commented 2020-08-14 09:53:21 -05:00 (Migrated from github.com)
Review

Fixed

Fixed
if int(C.git_buf_set(buf, cstr, clen)) != 0 {
return errors.New("could not set buffer")
}

View File

@ -6,6 +6,11 @@
typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload);
void _go_git_buf_fill_null(git_buf *buf)
{
memset(buf->ptr, '\0', buf->asize*sizeof(char));
}
void _go_git_populate_commit_sign_cb(git_rebase_options *opts)
{
opts->signing_cb = (git_commit_signing_cb)commitSignCallback;