credentials: unconfuse Go about the type
For some reason cgo thinks the `credtype` field does not exist in `git_cred` so let's put it into the C code.
This commit is contained in:
parent
ce19fa064f
commit
c5159e624e
|
@ -3,6 +3,8 @@ package git
|
|||
/*
|
||||
#include <git2.h>
|
||||
#include <git2/sys/cred.h>
|
||||
|
||||
git_credtype_t _go_git_cred_credtype(git_cred *cred);
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
@ -28,7 +30,7 @@ func (o *Cred) HasUsername() bool {
|
|||
}
|
||||
|
||||
func (o *Cred) Type() CredType {
|
||||
return (CredType)(o.ptr.credtype)
|
||||
return (CredType)(C._go_git_cred_credtype(o.ptr))
|
||||
}
|
||||
|
||||
func credFromC(ptr *C.git_cred) *Cred {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <git2.h>
|
||||
#include <git2/sys/odb_backend.h>
|
||||
#include <git2/sys/refdb_backend.h>
|
||||
#include <git2/sys/cred.h>
|
||||
|
||||
typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload);
|
||||
|
||||
|
@ -180,4 +181,8 @@ void _go_git_writestream_free(git_writestream *stream)
|
|||
stream->free(stream);
|
||||
}
|
||||
|
||||
git_credtype_t _go_git_cred_credtype(git_cred *cred) {
|
||||
return cred->credtype;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in New Issue