Skip to content
Merged
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
27 changes: 27 additions & 0 deletions test/tests/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ var exec = require("../../utils/execPromise");
describe("Commit", function() {
var NodeGit = require("../../");
var Repository = NodeGit.Repository;
var Commit = NodeGit.Commit;
var Diff = NodeGit.Diff;
var Oid = NodeGit.Oid;

var reposPath = local("../repos/workdir");
var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6";
Expand Down Expand Up @@ -604,6 +606,31 @@ describe("Commit", function() {
});
});

it("can lookup using a short id", function () {
return NodeGit.Repository.open(reposPath)
.then(function (repo) {
return Commit.lookupPrefix(repo, Oid.fromString("bf1da765"), 8);
})
.then(function (commit) {
assert.equal(commit.id().toString(),
"bf1da765e357a9b936d6d511f2c7b78e0de53632");
});
});

it("can find nth gen ancestor", function () {
return NodeGit.Repository.open(reposPath)
.then(function (repo) {
return repo.getCommit("b52067acaa755c3b3fc21b484ffed2bce4150f62");
})
.then(function (commit) {
return commit.nthGenAncestor(3);
})
.then(function (commit) {
assert.equal(commit.id().toString(),
"9b2f3a37d46d47248d2704b6a46ec7e197bcd48c");
});
});

describe("Commit's Author", function() {
before(function() {
this.author = this.commit.author();
Expand Down