Expose git_libgit2_version
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "blob.h"
|
||||
#include "library.h"
|
||||
#include "geef.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -112,6 +113,7 @@ static ErlNifFunc geef_funcs[] =
|
||||
{"tree_bypath", 2, geef_tree_bypath},
|
||||
{"blob_size", 1, geef_blob_size},
|
||||
{"blob_content", 1, geef_blob_content},
|
||||
{"library_version", 0, geef_library_version},
|
||||
};
|
||||
|
||||
ERL_NIF_INIT(geef, geef_funcs, load, NULL, upgrade, unload)
|
||||
|
||||
11
c_src/library.c
Normal file
11
c_src/library.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "erl_nif.h"
|
||||
#include <git2.h>
|
||||
|
||||
ERL_NIF_TERM geef_library_version(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
|
||||
{
|
||||
int major, minor, rev;
|
||||
|
||||
git_libgit2_version(&major, &minor, &rev);
|
||||
|
||||
return enif_make_tuple3(env, enif_make_int(env, major), enif_make_int(env, minor), enif_make_int(env, rev));
|
||||
}
|
||||
6
c_src/library.h
Normal file
6
c_src/library.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GEEF_LIBRARY_H
|
||||
#define GEEF_LIBRARY_H
|
||||
|
||||
ERL_NIF_TERM geef_library_version(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user