Merge pull request #1 from lht/port-to-libgit2

Port to libgit2
This commit is contained in:
Scott Chacon
2011-08-30 08:16:09 -07:00
4 changed files with 23 additions and 20 deletions

View File

@@ -3,13 +3,15 @@ REBAR=$(shell which rebar || echo ./rebar)
all: compile
./rebar:
erl -noshell -s inets start \
-eval 'httpc:request(get, {"http://hg.basho.com/rebar/downloads/rebar", []}, [], [{stream, "./rebar"}])' \
-s init stop
chmod +x ./rebar
erl -noshell -s inets start \
-eval 'httpc:request(get, {\
"http://hg.basho.com/rebar/downloads/rebar", []\
}, [], [{stream, "./rebar"}])' \
-s init stop
chmod +x ./rebar
compile: $(REBAR)
@$(REBAR) compile
@$(REBAR) compile
clean: $(REBAR)
@$(REBAR) clean
@$(REBAR) clean

View File

@@ -43,7 +43,7 @@ The API looks basically like this:
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.

View File

@@ -1,15 +1,16 @@
#include "erl_nif.h"
#include <stdio.h>
#include <git/commit.h>
#include <git/tag.h>
#include <git/common.h>
#include <git/errors.h>
#include <git/index.h>
#include <git/odb.h>
#include <git/oid.h>
#include <git/revwalk.h>
#include <git/repository.h>
#include <git/zlib.h>
#include <string.h>
#include <git2/commit.h>
#include <git2/tag.h>
#include <git2/common.h>
#include <git2/errors.h>
#include <git2/index.h>
#include <git2/odb.h>
#include <git2/oid.h>
#include <git2/revwalk.h>
#include <git2/repository.h>
#include <git2/zlib.h>
#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);
git_oid oid;
git_oid_mkstr(&oid, sha);
git_oid_fromstr(&oid, sha);
ErlNifBinary 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_oid oid;
git_oid_mkstr(&oid, sha);
git_oid_fromstr(&oid, sha);
int exists = git_odb_exists(odb, &oid);
if(exists == 1) {

2
geef
View File

@@ -1,4 +1,4 @@
#!/usr/local/Cellar/erlang/R14B/bin/escript
#!/usr/bin/env escript
%% -*- erlang -*-
%%! debug verbose -noshell -pa ebin