Skip to content

Commit d46f7da

Browse files
Add Node 0.11+ Compatibility using NAN nodegit#164
1 parent be6905d commit d46f7da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2703
-2575
lines changed

include/blob.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <v8.h>
99
#include <node.h>
1010
#include <string>
11+
#include "nan.h"
1112

1213
#include "git2.h"
1314

@@ -17,7 +18,7 @@ using namespace v8;
1718
class GitBlob : public ObjectWrap {
1819
public:
1920

20-
static Persistent<Function> constructor_template;
21+
static Persistent<FunctionTemplate> constructor_template;
2122
static void Initialize (Handle<v8::Object> target);
2223

2324
git_blob *GetValue();
@@ -28,13 +29,12 @@ class GitBlob : public ObjectWrap {
2829
GitBlob(git_blob *raw);
2930
~GitBlob();
3031

31-
static Handle<Value> New(const Arguments& args);
32+
static NAN_METHOD(New);
3233

33-
34-
static Handle<Value> Oid(const Arguments& args);
35-
static Handle<Value> Content(const Arguments& args);
36-
static Handle<Value> Size(const Arguments& args);
37-
static Handle<Value> IsBinary(const Arguments& args);
34+
static NAN_METHOD(Oid);
35+
static NAN_METHOD(Content);
36+
static NAN_METHOD(Size);
37+
static NAN_METHOD(IsBinary);
3838
git_blob *raw;
3939
};
4040

include/branch.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class Branch : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_branch *GetValue();
@@ -28,20 +30,19 @@ class Branch : public ObjectWrap {
2830
Branch(git_branch *raw);
2931
~Branch();
3032

31-
static Handle<Value> New(const Arguments& args);
32-
33-
34-
static Handle<Value> Create(const Arguments& args);
35-
static Handle<Value> Delete(const Arguments& args);
36-
static Handle<Value> Foreach(const Arguments& args);
37-
static Handle<Value> Move(const Arguments& args);
38-
static Handle<Value> Lookup(const Arguments& args);
39-
static Handle<Value> Name(const Arguments& args);
40-
static Handle<Value> Upstream(const Arguments& args);
41-
static Handle<Value> SetUpstream(const Arguments& args);
42-
static Handle<Value> UpstreamName(const Arguments& args);
43-
static Handle<Value> IsHead(const Arguments& args);
44-
static Handle<Value> RemoteName(const Arguments& args);
33+
static NAN_METHOD(New);
34+
35+
static NAN_METHOD(Create);
36+
static NAN_METHOD(Delete);
37+
static NAN_METHOD(Foreach);
38+
static NAN_METHOD(Move);
39+
static NAN_METHOD(Lookup);
40+
static NAN_METHOD(Name);
41+
static NAN_METHOD(Upstream);
42+
static NAN_METHOD(SetUpstream);
43+
static NAN_METHOD(UpstreamName);
44+
static NAN_METHOD(IsHead);
45+
static NAN_METHOD(RemoteName);
4546
git_branch *raw;
4647
};
4748

include/clone_options.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitCloneOptions : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_clone_options *GetValue();
@@ -28,8 +30,7 @@ class GitCloneOptions : public ObjectWrap {
2830
GitCloneOptions(git_clone_options *raw);
2931
~GitCloneOptions();
3032

31-
static Handle<Value> New(const Arguments& args);
32-
33+
static NAN_METHOD(New);
3334

3435
git_clone_options *raw;
3536
};

include/commit.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitCommit : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_commit *GetValue();
@@ -28,20 +30,19 @@ class GitCommit : public ObjectWrap {
2830
GitCommit(git_commit *raw);
2931
~GitCommit();
3032

31-
static Handle<Value> New(const Arguments& args);
32-
33-
34-
static Handle<Value> Oid(const Arguments& args);
35-
static Handle<Value> MessageEncoding(const Arguments& args);
36-
static Handle<Value> Message(const Arguments& args);
37-
static Handle<Value> Time(const Arguments& args);
38-
static Handle<Value> Offset(const Arguments& args);
39-
static Handle<Value> Committer(const Arguments& args);
40-
static Handle<Value> Author(const Arguments& args);
41-
static Handle<Value> TreeId(const Arguments& args);
42-
static Handle<Value> ParentCount(const Arguments& args);
43-
static Handle<Value> ParentId(const Arguments& args);
44-
static Handle<Value> NthGenAncestor(const Arguments& args);
33+
static NAN_METHOD(New);
34+
35+
static NAN_METHOD(Oid);
36+
static NAN_METHOD(MessageEncoding);
37+
static NAN_METHOD(Message);
38+
static NAN_METHOD(Time);
39+
static NAN_METHOD(Offset);
40+
static NAN_METHOD(Committer);
41+
static NAN_METHOD(Author);
42+
static NAN_METHOD(TreeId);
43+
static NAN_METHOD(ParentCount);
44+
static NAN_METHOD(ParentId);
45+
static NAN_METHOD(NthGenAncestor);
4546
git_commit *raw;
4647
};
4748

include/delta.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitDelta : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_diff_delta *GetValue();
@@ -28,13 +30,13 @@ class GitDelta : public ObjectWrap {
2830
GitDelta(git_diff_delta *raw);
2931
~GitDelta();
3032

31-
static Handle<Value> New(const Arguments& args);
33+
static NAN_METHOD(New);
3234

33-
static Handle<Value> OldFile(const Arguments& args);
34-
static Handle<Value> NewFile(const Arguments& args);
35-
static Handle<Value> Status(const Arguments& args);
36-
static Handle<Value> Similarity(const Arguments& args);
37-
static Handle<Value> Flags(const Arguments& args);
35+
static NAN_METHOD(OldFile);
36+
static NAN_METHOD(NewFile);
37+
static NAN_METHOD(Status);
38+
static NAN_METHOD(Similarity);
39+
static NAN_METHOD(Flags);
3840

3941
git_diff_delta *raw;
4042
};

include/diff.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitDiff : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_diff_list *GetValue();
@@ -26,10 +28,10 @@ class GitDiff : public ObjectWrap {
2628
GitDiff(git_diff_list *raw);
2729
~GitDiff();
2830

29-
static Handle<Value> New(const Arguments& args);
31+
static NAN_METHOD(New);
3032

33+
static NAN_METHOD(TreeToTree);
3134

32-
static Handle<Value> TreeToTree(const Arguments& args);
3335
static void TreeToTreeWork(uv_work_t* req);
3436
static void TreeToTreeAfterWork(uv_work_t* req);
3537

@@ -47,7 +49,7 @@ class GitDiff : public ObjectWrap {
4749
const git_diff_options * opts;
4850
Persistent<Function> callback;
4951
};
50-
static Handle<Value> TreeToIndex(const Arguments& args);
52+
static NAN_METHOD(TreeToIndex);
5153
static void TreeToIndexWork(uv_work_t* req);
5254
static void TreeToIndexAfterWork(uv_work_t* req);
5355

@@ -65,7 +67,7 @@ class GitDiff : public ObjectWrap {
6567
const git_diff_options * opts;
6668
Persistent<Function> callback;
6769
};
68-
static Handle<Value> IndexToWorkdir(const Arguments& args);
70+
static NAN_METHOD(IndexToWorkdir);
6971
static void IndexToWorkdirWork(uv_work_t* req);
7072
static void IndexToWorkdirAfterWork(uv_work_t* req);
7173

@@ -81,7 +83,7 @@ class GitDiff : public ObjectWrap {
8183
const git_diff_options * opts;
8284
Persistent<Function> callback;
8385
};
84-
static Handle<Value> TreeToWorkdir(const Arguments& args);
86+
static NAN_METHOD(TreeToWorkdir);
8587
static void TreeToWorkdirWork(uv_work_t* req);
8688
static void TreeToWorkdirAfterWork(uv_work_t* req);
8789

@@ -97,12 +99,12 @@ class GitDiff : public ObjectWrap {
9799
const git_diff_options * opts;
98100
Persistent<Function> callback;
99101
};
100-
static Handle<Value> Merge(const Arguments& args);
101-
static Handle<Value> FindSimilar(const Arguments& args);
102-
static Handle<Value> StatusChar(const Arguments& args);
103-
static Handle<Value> NumDeltas(const Arguments& args);
104-
static Handle<Value> NumDeltasOfType(const Arguments& args);
105-
static Handle<Value> GetPatch(const Arguments& args);
102+
static NAN_METHOD(Merge);
103+
static NAN_METHOD(FindSimilar);
104+
static NAN_METHOD(StatusChar);
105+
static NAN_METHOD(NumDeltas);
106+
static NAN_METHOD(NumDeltasOfType);
107+
static NAN_METHOD(GetPatch);
106108
git_diff_list *raw;
107109
};
108110

include/diff_file.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitDiffFile : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_diff_file *GetValue();
@@ -28,13 +30,13 @@ class GitDiffFile : public ObjectWrap {
2830
GitDiffFile(git_diff_file *raw);
2931
~GitDiffFile();
3032

31-
static Handle<Value> New(const Arguments& args);
33+
static NAN_METHOD(New);
3234

33-
static Handle<Value> Oid(const Arguments& args);
34-
static Handle<Value> Path(const Arguments& args);
35-
static Handle<Value> Size(const Arguments& args);
36-
static Handle<Value> Flags(const Arguments& args);
37-
static Handle<Value> Mode(const Arguments& args);
35+
static NAN_METHOD(Oid);
36+
static NAN_METHOD(Path);
37+
static NAN_METHOD(Size);
38+
static NAN_METHOD(Flags);
39+
static NAN_METHOD(Mode);
3840

3941
git_diff_file *raw;
4042
};

include/diff_find_options.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitDiffFindOptions : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_diff_find_options *GetValue();
@@ -28,8 +30,7 @@ class GitDiffFindOptions : public ObjectWrap {
2830
GitDiffFindOptions(git_diff_find_options *raw);
2931
~GitDiffFindOptions();
3032

31-
static Handle<Value> New(const Arguments& args);
32-
33+
static NAN_METHOD(New);
3334

3435
git_diff_find_options *raw;
3536
};

include/diff_list.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <node.h>
1010
#include <string>
1111

12+
#include "nan.h"
13+
1214
#include "git2.h"
1315

1416
using namespace node;
@@ -17,7 +19,7 @@ using namespace v8;
1719
class GitDiffList : public ObjectWrap {
1820
public:
1921

20-
static Persistent<Function> constructor_template;
22+
static Persistent<FunctionTemplate> constructor_template;
2123
static void Initialize (Handle<v8::Object> target);
2224

2325
git_diff_list *GetValue();
@@ -27,15 +29,15 @@ class GitDiffList : public ObjectWrap {
2729
private:
2830
GitDiffList(git_diff_list *raw);
2931
~GitDiffList();
32+
33+
static NAN_METHOD(New);
34+
35+
static NAN_METHOD(Merge);
36+
static NAN_METHOD(FindSimilar);
37+
static NAN_METHOD(Size);
38+
static NAN_METHOD(NumDeltasOfType);
39+
static NAN_METHOD(Patch);
3040

31-
static Handle<Value> New(const Arguments& args);
32-
33-
34-
static Handle<Value> Merge(const Arguments& args);
35-
static Handle<Value> FindSimilar(const Arguments& args);
36-
static Handle<Value> Size(const Arguments& args);
37-
static Handle<Value> NumDeltasOfType(const Arguments& args);
38-
static Handle<Value> Patch(const Arguments& args);
3941
git_diff_list *raw;
4042
};
4143

0 commit comments

Comments
 (0)