Skip to content

Commit 06b8da9

Browse files
committed
added new jquery git submodule for stress testing, renamed test runners
1 parent baaa417 commit 06b8da9

File tree

10 files changed

+25
-34
lines changed

10 files changed

+25
-34
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "vendor/libgit2"]
88
path = vendor/libgit2
99
url = git://github.com/libgit2/libgit2.git
10+
[submodule "example/stress/jquery"]
11+
path = example/stress/jquery
12+
url = https://github.com/jquery/jquery.git
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ var git = require( 'nodegit' );
1010
var curses = [ 'add', 'swears', 'here' ]
1111
, path = './.git'
1212
, branch = 'master'
13-
, wordExp = /\b\w+\b/g;
13+
, reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');
14+
1415

1516
// Set git path
1617
if ( process.argv.length < 3 ) {
@@ -44,17 +45,10 @@ git.repo( path, function( err, repo ) {
4445
var history = branch.history();
4546
history.on( 'commit', function( idx, commit ) {
4647
// Check commit messages first
47-
curses.forEach(function( curse ) {
48-
var messageWords = commit.message.match( wordExp );
49-
50-
messageWords.forEach(function( word ) {
51-
if ( word == curse ) {
52-
console.log( 'Curse detected in commit', commit.sha, 'message' );
53-
54-
return;
55-
}
56-
});
57-
});
48+
if ( reCurse.test(commit.message) ) {
49+
console.log( 'Curse detected in commit', commit.sha, 'message' );
50+
return;
51+
}
5852
});
5953
});
6054
});

example/stress/commit.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ var git = require( '../../' ).raw;
88
var start = new Date;
99

1010
var repo = new git.Repo();
11-
repo.open( '/home/tim/git/nodegit/.git', function() {
11+
repo.open( 'jquery/.git', function() {
1212
var commit = new git.Commit();
1313

14-
console.log( 'Time taken: ' + (+new Date-start) + 'ms' );
14+
//console.log( 'Time taken: ' + (+new Date-start) + 'ms' );
1515
});
1616

1717
})();
@@ -27,13 +27,13 @@ var git = require( '../../' ).raw;
2727
var start = new Date;
2828

2929
var repo = new git.Repo();
30-
repo.open( '/home/tim/git/nodegit/.git', function() {
30+
repo.open( 'jquery/.git', function() {
3131
var oid = new git.Oid();
32-
oid.mkstr( 'cb76e3c030ab29db332aff3b297dc39451a84762' );
32+
oid.mkstr( 'cf702496ee28830f3488ed3f1c3940cfbb2dfa8f' );
3333

3434
var commit = new git.Commit();
3535
commit.lookup( repo, oid, function( err ) {
36-
console.log( 'Time taken: ' + (+new Date-start) + 'ms' );
36+
//console.log( 'Time taken: ' + (+new Date-start) + 'ms' );
3737
});
3838
});
3939

example/stress/jquery

Submodule jquery added at cf70249

example/stress/repo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var git = require( 'nodegit' ).raw;
2323
(function() {
2424
var start = new Date;
2525
var repo = new git.Repo();
26-
repo.open( '/home/tim/git/nodegit/.git', function() {
26+
repo.open( 'jquery/.git', function() {
2727

2828
//console.log( 'Time taken: ' + (+new Date-start) + 'ms' );
2929
});

example/stress/revwalk.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ var git = require( 'nodegit' );
1212
//console.log( 'Repo opened' );
1313

1414
this.branch( 'master', function() {
15-
//console.log( 'Branch opened' );
16-
1715
this.history().on( 'commit', function( i, commit ) {
1816
//console.log( commit.id.toString(40) );
1917
});
20-
2118
});
2219
});
2320

test/index.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,21 @@ process.chdir( './test' );
3131
reporter.run(
3232
[
3333
// Raw API
34-
'raw-blob.js',
35-
'raw-commit.js',
36-
'raw-error.js',
37-
'raw-obj.js',
38-
'raw-oid.js',
39-
'raw-ref.js',
40-
'raw-repo.js',
41-
'raw-revwalk.js',
42-
// Revwalk
34+
'raw-blob.js'
35+
, 'raw-commit.js'
36+
, 'raw-error.js'
37+
, 'raw-object.js'
38+
, 'raw-oid.js'
39+
, 'raw-reference.js'
40+
, 'raw-repo.js'
41+
, 'raw-revwalk.js'
4342
// Sig
4443
// Tree
4544
// Tree Entry
4645
// Util
4746

48-
// TODO:
49-
//'raw-revwalk.js',
50-
5147
// Convenience API
52-
'convenience-repo.js'
48+
, 'convenience-repo.js'
5349
// Blob
5450
// Commit
5551
// Error
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)