FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/include/diff_list.h at v0.0.75 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
include
/
diff_list.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
133 lines (109 loc) · 3.8 KB
Breadcrumbs
nodegit
/
include
/
diff_list.h
Copy path
File metadata and controls
133 lines (109 loc) · 3.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
* @author Michael Robinson @codeofinterest <mike@pagesofinterest.net>
*
* Dual licensed under the MIT and GPL licenses.
*/
#
include
<
v8.h
>
#
include
<
node.h
>
#
include
<
vector
>
#
include
<
string
>
#
include
<
map
>
#
include
"
../vendor/libgit2/include/git2.h
"
#
include
"
../include/repo.h
"
using
namespace
node
;
using
namespace
v8
;
/*
*
* Class wrapper for libgit2 git_diff_list
*/
class
GitDiffList
:
public
ObjectWrap
{
public:
/*
*
* v8::FunctionTemplate used to create Node.js constructor
*/
static
Persistent<Function> constructor_template;
static
const
int
WALK_DELTA_THRESHHOLD
=
10
;
/*
*
* Used to intialize the EventEmitter from Node.js
*
* @param target v8::Object the Node.js module object
*/
static
void
Initialize
(Handle<v8::Object> target);
git_diff_list*
GetValue
();
void
SetValue
(git_diff_list* diffList);
void
Close
();
protected:
GitDiffList
() {}
~GitDiffList
() {}
static
Handle<Value>
New
(
const
Arguments& args);
static
Handle<Value>
Close
(
const
Arguments& args);
static
Handle<Value>
TreeToTree
(
const
Arguments& args);
static
void
TreeToTreeWork
(
uv_work_t
*req);
static
void
TreeToTreeAfterWork
(
uv_work_t
*req);
/*
*
* Walk the current git_diff_list
*/
static
Handle<Value>
Walk
(
const
Arguments& args);
static
void
WalkWork
(
void
*payload);
static
int
WalkWorkFile
(
const
git_diff_delta *delta,
float
progress,
void
*payload);
static
int
WalkWorkHunk
(
const
git_diff_delta *delta,
const
git_diff_range *range,
const
char
*header,
size_t
header_len,
void
*payload);
static
int
WalkWorkData
(
const
git_diff_delta *delta,
/*
* delta that contains this data
*/
const
git_diff_range *range,
/*
* range of lines containing this data
*/
char
line_origin,
/*
* git_diff_list_t value from above
*/
const
char
*content,
/*
* diff data - not NUL terminated
*/
size_t
content_len,
/*
* number of bytes of diff data
*/
void
*payload);
/*
* user reference data
*/
/*
*
* Called when WalkWorkFile reaches its cache
* thresholds. Passes data back to main thread
*
* @param payload The WalkBaton
*/
static
void
WalkWorkSendFile
(
uv_async_t
*handle,
int
status
/*
UNUSED
*/
);
static
void
WalkWorkSendHunk
(
uv_async_t
*handle,
int
status
/*
UNUSED
*/
);
static
void
WalkWorkSendData
(
uv_async_t
*handle,
int
status
/*
UNUSED
*/
);
static
void
WalkWorkSendEnd
(
uv_async_t
*handle,
int
status
/*
UNUSED
*/
);
private:
git_diff_list* diffList;
//
git_oid* oldOid;
//
git_oid* newOid;
struct
TreeToTreeBaton
{
uv_work_t
request;
const
git_error* error;
GitDiffList *diffList;
git_repository* repo;
git_oid oldOid;
std::string oldSha;
git_oid newOid;
std::string newSha;
git_diff_list* rawDiffList;
Persistent<Function> callback;
};
struct
DeltaContent
{
git_diff_range *range;
char
lineOrigin;
size_t
contentLength;
std::string content;
};
struct
Delta
{
git_diff_delta *raw;
std::vector<DeltaContent* > contents;
};
struct
WalkBaton
{
uv_thread_t
threadId;
uv_mutex_t
mutex;
uv_async_t
asyncFile;
uv_async_t
asyncHunk;
uv_async_t
asyncData;
uv_async_t
asyncEnd;
const
git_error* error;
std::map<std::string, Delta* > fileDeltas;
git_diff_list* rawDiffList;
Persistent<Function> fileCallback;
Persistent<Function> hunkCallback;
Persistent<Function> lineCallback;
Persistent<Function> endCallback;
};
};
Back
|
FazBrowse Home
|
New Git URL