Skip to content

Commit ec03074

Browse files
committed
General overview in examples
1 parent 698c74e commit ec03074

33 files changed

+1268
-480
lines changed

TODO

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
- rename all async methods getXXX
21
- audit all ** methods so that all finds go through the repo in js land so that the .repo pointer is set.
32
- rename files remove .h
43
- Cleanup diff api
54
- free everything malloc'd
65
- codegen documentation
76
- extract out more partials
7+
- audit return types for things that should be copied
8+
- array handling
9+
- make normalizeOid do more work.

binding.gyp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
'src/object.cc',
1212
'src/repo.cc',
1313
'src/index.cc',
14+
'src/index_entry.cc',
15+
'src/index_time.cc',
1416
'src/tag.cc',
1517
'src/revwalk.cc',
1618
'src/signature.cc',

example/general.js

Lines changed: 121 additions & 91 deletions
Large diffs are not rendered by default.

include/index.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class GitIndex : public ObjectWrap {
4444
const char * index_path;
4545
Persistent<Function> callback;
4646
};
47-
static Handle<Value> Owner(const Arguments& args);
4847
static Handle<Value> Read(const Arguments& args);
4948
static void ReadWork(uv_work_t* req);
5049
static void ReadAfterWork(uv_work_t* req);
@@ -96,8 +95,9 @@ class GitIndex : public ObjectWrap {
9695
git_index * index;
9796
Persistent<Function> callback;
9897
};
99-
static Handle<Value> Entrycount(const Arguments& args);
98+
static Handle<Value> Size(const Arguments& args);
10099
static Handle<Value> Clear(const Arguments& args);
100+
static Handle<Value> Entry(const Arguments& args);
101101
static Handle<Value> Remove(const Arguments& args);
102102
static Handle<Value> RemoveDirectory(const Arguments& args);
103103
static Handle<Value> AddBypath(const Arguments& args);

include/index_entry.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* This code is auto-generated; unless you know what you're doing, do not modify!
3+
**/
4+
5+
#ifndef GITINDEXENTRY_H
6+
#define GITINDEXENTRY_H
7+
8+
#include <v8.h>
9+
#include <node.h>
10+
#include <string>
11+
12+
#include "git2.h"
13+
14+
using namespace node;
15+
using namespace v8;
16+
17+
class GitIndexEntry : public ObjectWrap {
18+
public:
19+
20+
static Persistent<Function> constructor_template;
21+
static void Initialize (Handle<v8::Object> target);
22+
23+
git_index_entry *GetValue();
24+
25+
static Handle<Value> New(void *raw);
26+
27+
private:
28+
GitIndexEntry(git_index_entry *raw);
29+
~GitIndexEntry();
30+
31+
static Handle<Value> New(const Arguments& args);
32+
33+
static Handle<Value> Ctime(const Arguments& args);
34+
static Handle<Value> Mtime(const Arguments& args);
35+
static Handle<Value> Path(const Arguments& args);
36+
37+
git_index_entry *raw;
38+
};
39+
40+
#endif

include/index_time.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* This code is auto-generated; unless you know what you're doing, do not modify!
3+
**/
4+
5+
#ifndef GITINDEXTIME_H
6+
#define GITINDEXTIME_H
7+
8+
#include <v8.h>
9+
#include <node.h>
10+
#include <string>
11+
12+
#include "git2.h"
13+
14+
using namespace node;
15+
using namespace v8;
16+
17+
class GitIndexTime : public ObjectWrap {
18+
public:
19+
20+
static Persistent<Function> constructor_template;
21+
static void Initialize (Handle<v8::Object> target);
22+
23+
git_index_time *GetValue();
24+
25+
static Handle<Value> New(void *raw);
26+
27+
private:
28+
GitIndexTime(git_index_time *raw);
29+
~GitIndexTime();
30+
31+
static Handle<Value> New(const Arguments& args);
32+
33+
static Handle<Value> Seconds(const Arguments& args);
34+
static Handle<Value> Nanoseconds(const Arguments& args);
35+
36+
git_index_time *raw;
37+
};
38+
39+
#endif

include/odb.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,43 @@ class GitOdb : public ObjectWrap {
3535
static Handle<Value> Open(const Arguments& args);
3636
static Handle<Value> AddDiskAlternate(const Arguments& args);
3737
static Handle<Value> Read(const Arguments& args);
38+
static void ReadWork(uv_work_t* req);
39+
static void ReadAfterWork(uv_work_t* req);
40+
41+
struct ReadBaton {
42+
uv_work_t request;
43+
int error_code;
44+
const git_error* error;
45+
git_odb_object * out;
46+
Persistent<Value> dbReference;
47+
git_odb * db;
48+
Persistent<Value> idReference;
49+
const git_oid * id;
50+
Persistent<Function> callback;
51+
};
3852
static Handle<Value> ReadPrefix(const Arguments& args);
3953
static Handle<Value> ReadHeader(const Arguments& args);
4054
static Handle<Value> Exists(const Arguments& args);
4155
static Handle<Value> Refresh(const Arguments& args);
4256
static Handle<Value> Write(const Arguments& args);
57+
static void WriteWork(uv_work_t* req);
58+
static void WriteAfterWork(uv_work_t* req);
59+
60+
struct WriteBaton {
61+
uv_work_t request;
62+
int error_code;
63+
const git_error* error;
64+
git_oid * out;
65+
Persistent<Value> odbReference;
66+
git_odb * odb;
67+
Persistent<Value> dataReference;
68+
const void * data;
69+
Persistent<Value> lenReference;
70+
size_t len;
71+
Persistent<Value> typeReference;
72+
git_otype type;
73+
Persistent<Function> callback;
74+
};
4375
static Handle<Value> Hash(const Arguments& args);
4476
static Handle<Value> Hashfile(const Arguments& args);
4577
git_odb *raw;

include/odb_object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class GitOdbObject : public ObjectWrap {
3131
static Handle<Value> New(const Arguments& args);
3232

3333

34-
static Handle<Value> ObjectData(const Arguments& args);
35-
static Handle<Value> ObjectSize(const Arguments& args);
36-
static Handle<Value> ObjectType(const Arguments& args);
34+
static Handle<Value> Data(const Arguments& args);
35+
static Handle<Value> Size(const Arguments& args);
36+
static Handle<Value> Type(const Arguments& args);
3737
static Handle<Value> Oid(const Arguments& args);
3838
git_odb_object *raw;
3939
};

include/repo.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ class GitRepo : public ObjectWrap {
6161
};
6262
static Handle<Value> Path(const Arguments& args);
6363
static Handle<Value> Workdir(const Arguments& args);
64+
static Handle<Value> Odb(const Arguments& args);
65+
static Handle<Value> openIndex(const Arguments& args);
66+
static void openIndexWork(uv_work_t* req);
67+
static void openIndexAfterWork(uv_work_t* req);
68+
69+
struct openIndexBaton {
70+
uv_work_t request;
71+
int error_code;
72+
const git_error* error;
73+
git_index * out;
74+
Persistent<Value> repoReference;
75+
git_repository * repo;
76+
Persistent<Function> callback;
77+
};
6478
static Handle<Value> GetBlob(const Arguments& args);
6579
static void GetBlobWork(uv_work_t* req);
6680
static void GetBlobAfterWork(uv_work_t* req);
@@ -212,6 +226,20 @@ class GitRepo : public ObjectWrap {
212226
git_repository * repo;
213227
Persistent<Function> callback;
214228
};
229+
static Handle<Value> Delete(const Arguments& args);
230+
static void DeleteWork(uv_work_t* req);
231+
static void DeleteAfterWork(uv_work_t* req);
232+
233+
struct DeleteBaton {
234+
uv_work_t request;
235+
int error_code;
236+
const git_error* error;
237+
Persistent<Value> repoReference;
238+
git_repository * repo;
239+
Persistent<Value> tag_nameReference;
240+
const char * tag_name;
241+
Persistent<Function> callback;
242+
};
215243
git_repository *raw;
216244
};
217245

include/signature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class GitSignature : public ObjectWrap {
3434
static Handle<Value> Email(const Arguments& args);
3535
static Handle<Value> Time(const Arguments& args);
3636

37+
static Handle<Value> Create(const Arguments& args);
3738
static Handle<Value> Now(const Arguments& args);
3839
git_signature *raw;
3940
};

0 commit comments

Comments
 (0)