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
Show all changes
28 commits
Select commit Hold shift + click to select a range
458e080
Using code-generation to implement libgit2 c++ bindings. The oid clas…
nkallen Jun 18, 2013
42c7fa7
Blob is now code-gen'd
nkallen Jun 20, 2013
458d871
Repo is now code-gen'd
nkallen Jun 21, 2013
707675a
Reference is now code-gen'd
nkallen Jun 22, 2013
cf7d352
TreeEntry, Object, Commit, Signature, Time is now code-gen'd
nkallen Jun 22, 2013
c20ee68
Index is now code-gen'd
nkallen Jun 24, 2013
2d3b9b6
Tag now code-gen'd
nkallen Jun 24, 2013
552fae7
Threads & Tree now codgen'd
nkallen Jun 24, 2013
607ed27
Typos
nkallen Jun 24, 2013
d9ea5a6
Diff is now code-gen'd
nkallen Jun 25, 2013
0c65472
RevWalk now code-gen'd
nkallen Jun 27, 2013
271c65e
Removed unnecessary Error wrapper
nkallen Jun 27, 2013
486b0cc
Removed unnecessary success() utility
nkallen Jun 27, 2013
6527aac
Extracted a partial for conversion from v8 types to c types
nkallen Jun 27, 2013
8c83ea5
Put factory methods as instance methods on repo
nkallen Jun 28, 2013
a2a5479
Made the diff methods prototype methods
nkallen Jun 29, 2013
da4c29d
Raw and convenience API merged into one, using decorators
nkallen Jul 2, 2013
698c74e
GitOdb
nkallen Jul 3, 2013
ec03074
General overview in examples
nkallen Jul 3, 2013
4bf472d
Nicer diff API
nkallen Jul 3, 2013
6f85118
Refactored normalizeOid
nkallen Jul 3, 2013
5de9000
Extracted out partials so template code is slightly easier to follow
nkallen Jul 3, 2013
1273fff
Audit of memory leaks
nkallen Jul 4, 2013
eebd0ea
Made all the examples work
nkallen Jul 5, 2013
5915582
Basic support for arrays
nkallen Jul 5, 2013
075d481
Documentation for codegen
nkallen Jul 5, 2013
faefa7c
fixed broken test on linux: /etc/hosts -> /private/etc/hosts
nkallen Jul 15, 2013
25ae260
bug fixes
nkallen Jul 21, 2013
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
1 change: 1 addition & 0 deletions 1 TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- codegen documentation
22 changes: 19 additions & 3 deletions 22 binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,34 @@
'src/base.cc',
'src/blob.cc',
'src/commit.cc',
'src/error.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_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/functions/string.cc',
'src/functions/utilities.cc'
'src/wrapper.cc',
'src/refdb.cc',
'src/odb_object.cc',
'src/odb.cc',
'src/submodule.cc',
'src/functions/copy.cc',

],

'include_dirs': [
Expand Down
54 changes: 20 additions & 34 deletions 54 example/apps/git_profanity_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,36 @@
// Script to detect cursewords in commit messages and provide the
// offending commit sha's.
// vim: ft=javascript
var git = require( 'nodegit' );
var git = require('../../');

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


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

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

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

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

// Iterate history
var history = branch.history();
history.on( 'commit', function( idx, commit ) {
// Check commit messages first
if ( reCurse.test(commit.message) ) {
console.log( 'Curse detected in commit', commit.sha, 'message' );
return;
}
});
history.on('commit', function(commit) {
if (reCurse.test(commit.message()))
console.log('Curse detected in commit', commit.sha(), 'message', commit.message());
}).start();
});
});
48 changes: 0 additions & 48 deletions 48 example/convenience-commit.js

This file was deleted.

19 changes: 0 additions & 19 deletions 19 example/convenience-repo.js

This file was deleted.

23 changes: 0 additions & 23 deletions 23 example/convenience-tree.js

This file was deleted.

35 changes: 35 additions & 0 deletions 35 example/diff-commits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var git = require('../'),
path = require('path');

// This code examines the diffs between a particular commit and all of its
// parents. Since this commit is not a merge, it only has one parent. This is
// similar to doing `git show`.

git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
if (error) throw error;

repo.getCommit('59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5', function(error, commit) {
if (error) throw error;

console.log('commit ' + commit.sha());
console.log('Author:', commit.author().name() + ' <' + commit.author().email() + '>');
console.log('Date:', commit.date());
console.log('\n ' + commit.message());

commit.getDiff(function(error, diffList) {
if (error) throw error;

diffList.forEach(function(diff) {
diff.patches().forEach(function(patch) {
console.log("diff", patch.oldFile().path(), patch.newFile().path());
patch.hunks().forEach(function(hunk) {
console.log(hunk.header().trim());
hunk.lines().forEach(function(line) {
console.log(String.fromCharCode(line.lineOrigin) + line.content.trim());
});
});
});
});
});
});
});
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.