Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 3 .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/build/*
!/build/codegen/
/node_modules/
/vendor/libgit2/
/doc/*
!/doc/Theme.css
/node_modules
/test/.reposCache
2 changes: 1 addition & 1 deletion 2 LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013 Tim Branyen
Copyright (c) 2014 Tim Branyen

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
23 changes: 23 additions & 0 deletions 23 appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# appveyor file
# http://www.appveyor.com/docs/appveyor-yml
project_id: "e5a5q75l9yfhnfv2"

# build version format
version: "{build}"

# fix lineendings in Windows
init:
- git config --global core.autocrlf input

# what combinations to test
environment:
matrix:
- nodejs_version: 0.10
- nodejs_version: 0.8

# Get the latest stable version of Node 0.STABLE.latest
install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- npm install

build: off
132 changes: 71 additions & 61 deletions 132 binding.gyp
Original file line number Diff line number Diff line change
@@ -1,70 +1,80 @@
{
'targets': [
{
'target_name': 'nodegit',
'sources': [
'src/base.cc',
'src/blob.cc',
'src/commit.cc',
'src/oid.cc',
'src/reference.cc',
'src/object.cc',
'src/repo.cc',
'src/index.cc',
'src/index_entry.cc',
'src/index_time.cc',
'src/tag.cc',
'src/revwalk.cc',
'src/signature.cc',
'src/time.cc',
'src/tree.cc',
'src/tree_builder.cc',
'src/tree_entry.cc',
'src/diff_find_options.cc',
'src/diff_options.cc',
'src/diff_list.cc',
'src/patch.cc',
'src/delta.cc',
'src/diff_file.cc',
'src/diff_range.cc',
'src/threads.cc',
'src/wrapper.cc',
'src/refdb.cc',
'src/odb_object.cc',
'src/odb.cc',
'src/submodule.cc',
'src/remote.cc',
'src/clone_options.cc',
'src/functions/copy.cc',
"targets": [
{
"target_name": "nodegit",

],
"sources": [
"src/base.cc",
"src/blob.cc",
"src/commit.cc",
"src/oid.cc",
"src/reference.cc",
"src/object.cc",
"src/repo.cc",
"src/index.cc",
"src/index_entry.cc",
"src/index_time.cc",
"src/tag.cc",
"src/revwalk.cc",
"src/signature.cc",
"src/time.cc",
"src/tree.cc",
"src/tree_builder.cc",
"src/tree_entry.cc",
"src/diff_find_options.cc",
"src/diff_options.cc",
"src/diff_list.cc",
"src/patch.cc",
"src/delta.cc",
"src/diff_file.cc",
"src/diff_range.cc",
"src/threads.cc",
"src/wrapper.cc",
"src/refdb.cc",
"src/odb_object.cc",
"src/odb.cc",
"src/submodule.cc",
"src/remote.cc",
"src/clone_options.cc",
"src/functions/copy.cc",
],

'include_dirs': [
'vendor/libv8-convert',
'vendor/libgit2/include',
"<!(node -e \"require('nan')\")"
],
"include_dirs": [
"vendor/libv8-convert",
"vendor/libgit2/include",
"<!(node -e \"require('nan')\")"
],

'libraries': [
'-L<!(pwd)/vendor/libgit2/build',
'-lgit2'
],
"cflags": [
"-Wall"
],

'cflags': [
'-Wall'
],
"ldflags": [
"-Wl,-rpath,\$$ORIGIN/../../vendor/libgit2/build"
],

'ldflags': [
'-Wl,-rpath,\$$ORIGIN/../../vendor/libgit2/build'
"conditions": [
[
"OS=='win'", {
"libraries": [
"-l../vendor/libgit2/build/Debug/git2.lib"
],

'conditions': [
['OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}]
}, { # 'OS!="win"'
"libraries": [
"-L<!(pwd)/vendor/libgit2/build",
"-lgit2"
]
}
]
}
],

[
"OS=='mac'", {
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES"
}
}
]
]
}
]
}
4 changes: 2 additions & 2 deletions 4 build/codegen/templates/convertFromV8.cc.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<% } else if (arg.cppClassName == 'Buffer') { -%>
from_<%- arg.name %> = Buffer::Data(args[<%- jsArg %>]->ToObject());
<% } else if (isV8Value(arg.cppClassName)) { -%>
from_<%- arg.name %> = (<%- arg.cType %>) args[<%- jsArg %>]->To<%- arg.cppClassName %>()->Value();
from_<%- arg.name %> = (<%- arg.cType %>) <%- arg.additionalCast %> <%- arg.cast %> args[<%- jsArg %>]->To<%- arg.cppClassName %>()->Value();
<% } else { -%>
from_<%- arg.name %> = ObjectWrap::Unwrap<<%- arg.cppClassName %>>(args[<%- jsArg %>]->ToObject())->GetValue();
<% } -%>
Expand All @@ -29,4 +29,4 @@
from_<%- arg.name %> = 0;
}
<% } -%>
<% } -%>
<% } -%>
6 changes: 4 additions & 2 deletions 6 build/codegen/v0.18.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -10380,7 +10380,8 @@
"cType": "git_direction",
"cppClassName": "Number",
"jsClassName": "Number",
"comment": "GIT_DIRECTION_FETCH if you want to fetch or GIT_DIRECTION_PUSH if you want to push"
"comment": "GIT_DIRECTION_FETCH if you want to fetch or GIT_DIRECTION_PUSH if you want to push",
"additionalCast": "(int)"
}
],
"isAsync": true,
Expand Down Expand Up @@ -17283,7 +17284,8 @@
"cType": "git_filemode_t",
"cppClassName": "Number",
"jsClassName": "Number",
"comment": "Folder attributes of the entry. This parameter must be valued with one of the following entries: 0040000, 0100644, 0100755, 0120000 or 0160000."
"comment": "Folder attributes of the entry. This parameter must be valued with one of the following entries: 0040000, 0100644, 0100755, 0120000 or 0160000.",
"additionalCast": "(int)"
}
],
"isAsync": false,
Expand Down
68 changes: 47 additions & 21 deletions 68 example/apps/git_profanity_check.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,66 @@
#!/usr/bin/env node
// vim: ft=javascript

// Copyright 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
// Copyright 2011-2014, Tim Branyen @tbranyen <tim@tabdeveloper.com>
// Dual licensed under the MIT and GPL licenses.
// Script to detect cursewords in commit messages and provide the
// offending commit sha's.
// vim: ft=javascript
// Script to detect cursewords in commit messages and provide the offending
// commit sha's.
//
// Usage:
//
// node git_profanity_check some/repo/.git
//
var git = require('../../');

var curses = ['add', 'swears', 'here'],
path = '../../.git',
branchName = 'master',
reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');

var curses = ['put', 'curse', 'words', 'here'];
var path = './.git';
var branch = 'master';
var reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');

// Default path is `.git`.
if (process.argv.length < 3) {
console.log('No git path passed as argument, defaulting to ./.git');
} else {
console.log('No path passed as argument, defaulting to .git.');
}
// Otherwise defaults.
else {
path = process.argv[2];

// Set repo branch
if (process.argv.length < 4) {
console.log('No repo branchName passed as argument, defaulting to master');
} else {
branchName = process.argv[3];
console.log('No branch passed as argument, defaulting to master.');
}
else {
branch = process.argv[3];
}
}

git.Repo.open(path, function(error, repo) {
if (error) throw error;
// Open repository.
git.Repo.open(path, function(err, repo) {
if (err) {
throw new Error(err);
}

repo.getBranch(branchName, function(error, branch) {
if (error) throw error;
// Open branch, default to master.
repo.getBranch(branch, function(err, branch) {
if (err) {
throw new Error(err);
}

// Iterate history
var history = branch.history();

// Iterate over every commit message and test for words.
history.on('commit', function(commit) {
if (reCurse.test(commit.message()))
console.log('Curse detected in commit', commit.sha(), 'message', commit.message());
}).start();
var message = commit.message();

if (reCurse.test(message)) {
console.log('Curse detected in commit', commit.sha());
console.log('=> ', message);
return;
}
});

// Start history iteration.
history.start();
});
});
14 changes: 7 additions & 7 deletions 14 include/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <v8.h>
#include <node.h>
#include <string>
#include "nan.h"

#include "git2.h"

Expand All @@ -18,7 +17,7 @@ using namespace v8;
class GitBlob : public ObjectWrap {
public:

static Persistent<FunctionTemplate> constructor_template;
static Persistent<Function> constructor_template;
static void Initialize (Handle<v8::Object> target);

git_blob *GetValue();
Expand All @@ -29,12 +28,13 @@ class GitBlob : public ObjectWrap {
GitBlob(git_blob *raw);
~GitBlob();

static NAN_METHOD(New);
static Handle<Value> New(const Arguments& args);

static NAN_METHOD(Oid);
static NAN_METHOD(Content);
static NAN_METHOD(Size);
static NAN_METHOD(IsBinary);

static Handle<Value> Oid(const Arguments& args);
static Handle<Value> Content(const Arguments& args);
static Handle<Value> Size(const Arguments& args);
static Handle<Value> IsBinary(const Arguments& args);
git_blob *raw;
};

Expand Down
31 changes: 15 additions & 16 deletions 31 include/branch.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <node.h>
#include <string>

#include "nan.h"

#include "git2.h"

using namespace node;
Expand All @@ -19,7 +17,7 @@ using namespace v8;
class Branch : public ObjectWrap {
public:

static Persistent<FunctionTemplate> constructor_template;
static Persistent<Function> constructor_template;
static void Initialize (Handle<v8::Object> target);

git_branch *GetValue();
Expand All @@ -30,19 +28,20 @@ class Branch : public ObjectWrap {
Branch(git_branch *raw);
~Branch();

static NAN_METHOD(New);

static NAN_METHOD(Create);
static NAN_METHOD(Delete);
static NAN_METHOD(Foreach);
static NAN_METHOD(Move);
static NAN_METHOD(Lookup);
static NAN_METHOD(Name);
static NAN_METHOD(Upstream);
static NAN_METHOD(SetUpstream);
static NAN_METHOD(UpstreamName);
static NAN_METHOD(IsHead);
static NAN_METHOD(RemoteName);
static Handle<Value> New(const Arguments& args);


static Handle<Value> Create(const Arguments& args);
static Handle<Value> Delete(const Arguments& args);
static Handle<Value> Foreach(const Arguments& args);
static Handle<Value> Move(const Arguments& args);
static Handle<Value> Lookup(const Arguments& args);
static Handle<Value> Name(const Arguments& args);
static Handle<Value> Upstream(const Arguments& args);
static Handle<Value> SetUpstream(const Arguments& args);
static Handle<Value> UpstreamName(const Arguments& args);
static Handle<Value> IsHead(const Arguments& args);
static Handle<Value> RemoteName(const Arguments& args);
git_branch *raw;
};

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.