4
Makefile
4
Makefile
@@ -4,7 +4,9 @@ all: compile
|
|||||||
|
|
||||||
./rebar:
|
./rebar:
|
||||||
erl -noshell -s inets start \
|
erl -noshell -s inets start \
|
||||||
-eval 'httpc:request(get, {"http://hg.basho.com/rebar/downloads/rebar", []}, [], [{stream, "./rebar"}])' \
|
-eval 'httpc:request(get, {\
|
||||||
|
"http://hg.basho.com/rebar/downloads/rebar", []\
|
||||||
|
}, [], [{stream, "./rebar"}])' \
|
||||||
-s init stop
|
-s init stop
|
||||||
chmod +x ./rebar
|
chmod +x ./rebar
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ The API looks basically like this:
|
|||||||
CONTRIBUTING
|
CONTRIBUTING
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Fork schacon/ribbit on GitHub, make it awesomer (preferably in a branch named
|
Fork schacon/geef on GitHub, make it awesomer (preferably in a branch named
|
||||||
for the topic), send a pull request.
|
for the topic), send a pull request.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
25
c_src/geef.c
25
c_src/geef.c
@@ -1,15 +1,16 @@
|
|||||||
#include "erl_nif.h"
|
#include "erl_nif.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <git/commit.h>
|
#include <string.h>
|
||||||
#include <git/tag.h>
|
#include <git2/commit.h>
|
||||||
#include <git/common.h>
|
#include <git2/tag.h>
|
||||||
#include <git/errors.h>
|
#include <git2/common.h>
|
||||||
#include <git/index.h>
|
#include <git2/errors.h>
|
||||||
#include <git/odb.h>
|
#include <git2/index.h>
|
||||||
#include <git/oid.h>
|
#include <git2/odb.h>
|
||||||
#include <git/revwalk.h>
|
#include <git2/oid.h>
|
||||||
#include <git/repository.h>
|
#include <git2/revwalk.h>
|
||||||
#include <git/zlib.h>
|
#include <git2/repository.h>
|
||||||
|
#include <git2/zlib.h>
|
||||||
|
|
||||||
#define MAXBUFLEN 1024
|
#define MAXBUFLEN 1024
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ geef_hex_to_raw(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
|
|||||||
return enif_make_badarg(env);
|
return enif_make_badarg(env);
|
||||||
|
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_oid_mkstr(&oid, sha);
|
git_oid_fromstr(&oid, sha);
|
||||||
|
|
||||||
ErlNifBinary ibin;
|
ErlNifBinary ibin;
|
||||||
enif_alloc_binary(20, &ibin);
|
enif_alloc_binary(20, &ibin);
|
||||||
@@ -49,7 +50,7 @@ geef_object_exists(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
|
|||||||
git_odb_open(&odb, path);
|
git_odb_open(&odb, path);
|
||||||
|
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_oid_mkstr(&oid, sha);
|
git_oid_fromstr(&oid, sha);
|
||||||
|
|
||||||
int exists = git_odb_exists(odb, &oid);
|
int exists = git_odb_exists(odb, &oid);
|
||||||
if(exists == 1) {
|
if(exists == 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user