| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,9 @@ var exec = require("../../utils/execPromise"); | |||
| 13 | 13 | describe("Commit", function() { | |
| 14 | 14 | var NodeGit = require("../../"); | |
| 15 | 15 | var Repository = NodeGit.Repository; | |
| 16 | + var Commit = NodeGit.Commit; | ||
| 16 | 17 | var Diff = NodeGit.Diff; | |
| 18 | + var Oid = NodeGit.Oid; | ||
| 17 | 19 | ||
| 18 | 20 | var reposPath = local("../repos/workdir"); | |
| 19 | 21 | var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6"; | |
@@ -604,6 +606,31 @@ describe("Commit", function() { | |||
| 604 | 606 | }); | |
| 605 | 607 | }); | |
| 606 | 608 | ||
| 609 | + it("can lookup using a short id", function () { | ||
| 610 | + return NodeGit.Repository.open(reposPath) | ||
| 611 | + .then(function (repo) { | ||
| 612 | + return Commit.lookupPrefix(repo, Oid.fromString("bf1da765"), 8); | ||
| 613 | + }) | ||
| 614 | + .then(function (commit) { | ||
| 615 | + assert.equal(commit.id().toString(), | ||
| 616 | + "bf1da765e357a9b936d6d511f2c7b78e0de53632"); | ||
| 617 | + }); | ||
| 618 | + }); | ||
| 619 | + | ||
| 620 | + it("can find nth gen ancestor", function () { | ||
| 621 | + return NodeGit.Repository.open(reposPath) | ||
| 622 | + .then(function (repo) { | ||
| 623 | + return repo.getCommit("b52067acaa755c3b3fc21b484ffed2bce4150f62"); | ||
| 624 | + }) | ||
| 625 | + .then(function (commit) { | ||
| 626 | + return commit.nthGenAncestor(3); | ||
| 627 | + }) | ||
| 628 | + .then(function (commit) { | ||
| 629 | + assert.equal(commit.id().toString(), | ||
| 630 | + "9b2f3a37d46d47248d2704b6a46ec7e197bcd48c"); | ||
| 631 | + }); | ||
| 632 | + }); | ||
| 633 | + | ||
| 607 | 634 | describe("Commit's Author", function() { | |
| 608 | 635 | before(function() { | |
| 609 | 636 | this.author = this.commit.author(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments