FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add missing fields to index entry by papandreou · Pull Request #95 · nodegit/nodegit · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cc  (1) .h  (1) .json  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 9 additions & 0 deletions include/index_entry.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class GitIndexEntry : public ObjectWrap {

static Handle<Value> Ctime(const Arguments& args);
static Handle<Value> Mtime(const Arguments& args);
static Handle<Value> Dev(const Arguments& args);
static Handle<Value> Ino(const Arguments& args);
static Handle<Value> Mode(const Arguments& args);
static Handle<Value> Uid(const Arguments& args);
static Handle<Value> gid(const Arguments& args);
static Handle<Value> FileSize(const Arguments& args);
static Handle<Value> Oid(const Arguments& args);
static Handle<Value> Flags(const Arguments& args);
static Handle<Value> FlagsExtended(const Arguments& args);
static Handle<Value> Path(const Arguments& args);

git_index_entry *raw;
Expand Down
116 changes: 116 additions & 0 deletions src/index_entry.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "../include/index_entry.h"
#include "../include/index_time.h"
#include "../include/oid.h"

using namespace v8;
using namespace node;
Expand All @@ -34,6 +35,15 @@ void GitIndexEntry::Initialize(Handle<v8::Object> target) {

NODE_SET_PROTOTYPE_METHOD(tpl, "ctime", Ctime);
NODE_SET_PROTOTYPE_METHOD(tpl, "mtime", Mtime);
NODE_SET_PROTOTYPE_METHOD(tpl, "dev", Dev);
NODE_SET_PROTOTYPE_METHOD(tpl, "ino", Ino);
NODE_SET_PROTOTYPE_METHOD(tpl, "mode", Mode);
NODE_SET_PROTOTYPE_METHOD(tpl, "uid", Uid);
NODE_SET_PROTOTYPE_METHOD(tpl, "gid", gid);
NODE_SET_PROTOTYPE_METHOD(tpl, "file_size", FileSize);
NODE_SET_PROTOTYPE_METHOD(tpl, "oid", Oid);
NODE_SET_PROTOTYPE_METHOD(tpl, "flags", Flags);
NODE_SET_PROTOTYPE_METHOD(tpl, "flags_extended", FlagsExtended);
NODE_SET_PROTOTYPE_METHOD(tpl, "path", Path);

constructor_template = Persistent<Function>::New(tpl->GetFunction());
Expand Down Expand Up @@ -100,6 +110,112 @@ Handle<Value> GitIndexEntry::Mtime(const Arguments& args) {
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Dev(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

unsigned int dev =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->dev;

to = Uint32::New(dev);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Ino(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

unsigned int ino =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->ino;

to = Uint32::New(ino);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Mode(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

uint16_t mode =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->mode;

to = Integer::New(mode);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Uid(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

unsigned int uid =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->uid;

to = Uint32::New(uid);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::gid(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

unsigned int gid =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->gid;

to = Uint32::New(gid);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::FileSize(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

unsigned int file_size =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->file_size;

to = Uint32::New(file_size);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Oid(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

git_oid *oid =
&ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->oid;

if (oid != NULL) {
oid = (git_oid *)git_oid_dup(oid);
}
if (oid != NULL) {
to = GitOid::New((void *)oid);
} else {
to = Null();
}
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Flags(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

uint16_t flags =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->flags;

to = Integer::New(flags);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::FlagsExtended(const Arguments& args) {
HandleScope scope;
Handle<Value> to;

uint16_t flags_extended =
ObjectWrap::Unwrap<GitIndexEntry>(args.This())->GetValue()->flags_extended;

to = Integer::New(flags_extended);
return scope.Close(to);
}

Handle<Value> GitIndexEntry::Path(const Arguments& args) {
HandleScope scope;
Handle<Value> to;
Expand Down
76 changes: 75 additions & 1 deletion v0.18.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,8 @@
{
"filename": "index_entry.h",
"dependencies": [
"../include/index_time.h"
"../include/index_time.h",
"../include/oid.h"
],
"jsClassName": "IndexEntry",
"cppClassName": "GitIndexEntry",
Expand All @@ -4167,6 +4168,79 @@
"jsClassName": "IndexTime",
"copy": "git_index_time_dup"
},
{
"jsFunctionName": "dev",
"cppFunctionName": "Dev",
"name": "dev",
"cType": "unsigned int",
"cppClassName": "Uint32",
"jsClassName": "Number"
},
{
"jsFunctionName": "ino",
"cppFunctionName": "Ino",
"name": "ino",
"cType": "unsigned int",
"cppClassName": "Uint32",
"jsClassName": "Number"
},
{
"jsFunctionName": "mode",
"cppFunctionName": "Mode",
"name": "mode",
"cType": "uint16_t",
"cppClassName": "Integer",
"jsClassName": "Number"
},
{
"jsFunctionName": "uid",
"cppFunctionName": "Uid",
"name": "uid",
"cType": "unsigned int",
"cppClassName": "Uint32",
"jsClassName": "Number"
},
{
"jsFunctionName": "gid",
"cppFunctionName": "gid",
"name": "gid",
"cType": "unsigned int",
"cppClassName": "Uint32",
"jsClassName": "Number"
},
{
"jsFunctionName": "file_size",
"cppFunctionName": "FileSize",
"name": "file_size",
"cType": "unsigned int",
"cppClassName": "Uint32",
"jsClassName": "Number"
},
{
"jsFunctionName": "oid",
"cppFunctionName": "Oid",
"name": "oid",
"cType": "git_oid",
"cppClassName": "GitOid",
"jsClassName": "Oid",
"copy": "git_oid_dup"
},
{
"jsFunctionName": "flags",
"cppFunctionName": "Flags",
"name": "flags",
"cType": "uint16_t",
"cppClassName": "Integer",
"jsClassName": "Number"
},
{
"jsFunctionName": "flags_extended",
"cppFunctionName": "FlagsExtended",
"name": "flags_extended",
"cType": "uint16_t",
"cppClassName": "Integer",
"jsClassName": "Number"
},
{
"jsFunctionName": "path",
"cppFunctionName": "Path",
Expand Down

Back | FazBrowse Home | New Git URL