/**
* Copyright (c) 2011, Tim Branyen @tbranyen
* @author Michael Robinson @codeofinterest
*
* Dual licensed under the MIT and GPL licenses.
*/
#ifndef REF_H
#define REF_H
#include
#include
#include
#include "git2.h"
#include "repo.h"
#include "oid.h"
using namespace node;
using namespace v8;
class GitReference : public ObjectWrap {
public:
const git_oid* Oid();
static Persistent constructor_template;
static void Initialize(Handle target);
git_reference* GetValue();
void SetValue(git_reference* ref);
protected:
GitReference() {}
~GitReference() {}
static Handle New(const Arguments& args);
static Handle Oid(const Arguments& args);
static void OidWork(uv_work_t* req);
static void OidAfterWork(uv_work_t* req);
static Handle Lookup(const Arguments& args);
static void LookupWork(uv_work_t* req);
static void LookupAfterWork(uv_work_t* req);
private:
git_reference *ref;
struct LookupBaton {
uv_work_t request;
const git_error* error;
GitReference* ref;
git_reference* rawRef;
git_repository* rawRepo;
std::string name;
Persistent callback;
};
struct OidBaton {
uv_work_t request;
const git_error* error;
const git_oid* rawOid;
git_reference* rawRef;
Persistent callback;
};
};
#endif