More diff functionality #629
9
diff.go
9
diff.go
|
@ -4,7 +4,6 @@ package git
|
||||||
#include <git2.h>
|
#include <git2.h>
|
||||||
|
|
||||||
extern void _go_git_populate_apply_cb(git_apply_options *options);
|
extern void _go_git_populate_apply_cb(git_apply_options *options);
|
||||||
extern void _go_git_apply_init_options(git_apply_options *options);
|
|
||||||
extern int _go_git_diff_foreach(git_diff *diff, int eachFile, int eachHunk, int eachLine, void *payload);
|
extern int _go_git_diff_foreach(git_diff *diff, int eachFile, int eachHunk, int eachLine, void *payload);
|
||||||
extern void _go_git_setup_diff_notify_callbacks(git_diff_options* opts);
|
extern void _go_git_setup_diff_notify_callbacks(git_diff_options* opts);
|
||||||
extern int _go_git_diff_blobs(git_blob *old, const char *old_path, git_blob *new, const char *new_path, git_diff_options *opts, int eachFile, int eachHunk, int eachLine, void *payload);
|
extern int _go_git_diff_blobs(git_blob *old, const char *old_path, git_blob *new, const char *new_path, git_diff_options *opts, int eachFile, int eachHunk, int eachLine, void *payload);
|
||||||
|
@ -918,7 +917,13 @@ func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int
|
||||||
func DefaultApplyOptions() (*ApplyOptions, error) {
|
func DefaultApplyOptions() (*ApplyOptions, error) {
|
||||||
opts := C.git_apply_options{}
|
opts := C.git_apply_options{}
|
||||||
|
|
||||||
C._go_git_apply_init_options(&opts)
|
ecode := C.git_apply_options_init(&opts, C.GIT_APPLY_OPTIONS_VERSION)
|
||||||
|
if int(ecode) != 0 {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
return nil, MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
|
||||||
return applyOptionsFromC(&opts), nil
|
return applyOptionsFromC(&opts), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,6 @@
|
||||||
|
|
||||||
typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload);
|
typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload);
|
||||||
|
|
||||||
void _go_git_apply_init_options(git_apply_options *options)
|
|
||||||
{
|
|
||||||
git_apply_options opts = GIT_APPLY_OPTIONS_INIT;
|
|
||||||
*options = opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _go_git_populate_apply_cb(git_apply_options *options)
|
void _go_git_populate_apply_cb(git_apply_options *options)
|
||||||
{
|
{
|
||||||
options->delta_cb = (git_apply_delta_cb)deltaApplyCallback;
|
options->delta_cb = (git_apply_delta_cb)deltaApplyCallback;
|
||||||
|
|
Loading…
Reference in New Issue