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

Add revwalk.hide and revwalk.simplifyFirstParent by tbranyen · Pull Request #235 · 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 .js  (1) .json  (2) All 2 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
17 changes: 16 additions & 1 deletion generate/descriptor.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 @@ -156,7 +156,7 @@
{},
{},
{},
{
{
"cType": "const git_commit **",
"arrayElementCppClassName": "GitCommit"
}
Expand Down Expand Up @@ -709,6 +709,21 @@
}
},

"git_revwalk_hide": {
"ignore": false,
"isAsync": false,
"args": [{ "isSelf": true, "isReturn": false }],
"return": {
"isErrorCode": true
}
},

"git_revwalk_simplify_first_parent": {
"ignore": false,
"isAsync": false,
"args": [{ "isSelf": true, "isReturn": false }]
},

"git_revwalk_next": {
"ignore": false,
"args": [
Expand Down
3 changes: 2 additions & 1 deletion generate/types.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 @@ -3365,6 +3365,7 @@
"js": "Config"
},
"const git_config **": {
"cpp": "GitConfig",
"js": "Config"
},
"git_config_find_global *": {
Expand Down Expand Up @@ -9147,4 +9148,4 @@
"cpp": "InitInitOptions",
"js": "initInitOptions"
}
}
}
60 changes: 60 additions & 0 deletions test/tests/revwalk.js
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
@@ -0,0 +1,60 @@
var assert = require("assert");
var path = require("path");

describe("Revwalk", function() {
var reposPath = path.resolve("test/repos/workdir/.git");

var Repository = require("../../lib/repository");
var Revwalk = require("../../lib/revwalk");
var Oid = require("../../lib/oid");

before(function() {
var test = this;

return Repository.open(reposPath).then(function(repository) {
test.repository = repository;
test.walker = repository.createRevWalk();

return test.repository.getMaster().then(function(master) {
test.master = master;
test.walker.push(test.master.id());
});
});
});

it("can create a walker", function() {
assert.ok(this.walker instanceof Revwalk);
});

it("can push an object", function() {
var sha = this.master.sha();

return this.walker.next().then(function(commit) {
assert.equal(sha, commit);
});
});

it("can hide an object", function() {
var test = this;

this.walker.hide(Oid.fromstr("a03e044fcb45c654d4e15a4e495a6a0c6e632854"));

return test.walker.next().then(function(commit) {
return test.walker.next().then(function(commit) {
assert.equal(commit, "1efa3354299ede235f90880383176fb5d48aaa89");
});
});
});

it("can simplify to first parent", function() {
var test = this;

test.walker.simplifyFirstParent();

return test.walker.next().then(function(commit) {
return test.walker.next().then(function(commit) {
assert.equal(commit, "231c550f3ec28874b4c426fc9eebad9a742e1332");
});
});
});
});

Back | FazBrowse Home | New Git URL