Permalink
Browse files

Merge pull request #198 from nodegit/open-index

Add Repo.openIndex
  • Loading branch information...
2 parents 9044ac3 + d5e1a03 commit b21ff7c052c25e9423b5f254491ea9889708795b @tbranyen tbranyen committed Jul 16, 2014
Showing with 16 additions and 0 deletions.
  1. +4 −0 generate/descriptor.json
  2. +5 −0 lib/repository.js
  3. +7 −0 test/tests/repository.js
View
4 generate/descriptor.json
@@ -528,6 +528,10 @@
"ignore": false
},
+ "git_repository_index": {
+ "ignore": false
+ },
+
"git_repository_init": {
"isConstructorMethod": true,
"ignore": false
View
5 lib/repository.js
@@ -9,6 +9,11 @@ var Commit = require("./commit");
var TreeBuilder = NodeGit.Treebuilder;
var Repository = NodeGit.Repository;
+Object.defineProperty(Repository.prototype, "openIndex", {
+ enumerable: false,
+ value: Repository.prototype.index
+});
+
/**
* Look up a branch"s most recent commit.
*
View
7 test/tests/repository.js
@@ -6,6 +6,7 @@ describe("Repository", function() {
var newRepo = path.resolve("test/repos/newrepo");
var Repository = require("../../lib/repository");
+ var Index = require("../../lib/index");
before(function() {
var test = this;
@@ -38,4 +39,10 @@ describe("Repository", function() {
return Repository.open(newRepo);
});
});
+
+ it("can read the index", function() {
+ return this.repository.index().then(function(index) {
+ assert.ok(index instanceof Index);
+ });
+ });
});

0 comments on commit b21ff7c

Please sign in to comment.