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

Fix repo init ext by maxkorp · Pull Request #317 · 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  (2) All 1 file type 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
9 changes: 9 additions & 0 deletions lib/repository.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
Expand Up @@ -7,6 +7,7 @@ var Revwalk = require("./revwalk");
var Commit = require("./commit");
var Remote = require("./remote");
var Promise = require("nodegit-promise");
var normalizeOptions = require("./util/normalize_options");

var TreeBuilder = NodeGit.Treebuilder;
var Repository = NodeGit.Repository;
Expand Down Expand Up @@ -641,4 +642,12 @@ Repository.prototype.mergeBranches = function(to, from, signature) {
});
};

// Override Repository.initExt to normalize initoptions
var initExt = Repository.initExt;
Repository.initExt = function(repo_path, opts) {
opts = normalizeOptions(opts, NodeGit.RepositoryInitOptions);
return initExt(repo_path, opts);
};


module.exports = Repository;
10 changes: 10 additions & 0 deletions test/tests/repository.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
@@ -1,5 +1,7 @@
var assert = require("assert");
var path = require("path");
var promisify = require("promisify-node");
var fse = promisify(require("fs-extra"));

describe("Repository", function() {
var reposPath = path.resolve("test/repos/workdir/.git");
Expand Down Expand Up @@ -41,6 +43,14 @@ describe("Repository", function() {
});
});

it("can utilize repository init options", function() {
return fse.remove(newRepo).then(function() {
return Repository.initExt(newRepo, {
flags: Repository.INIT_FLAG.MKPATH
});
});
});

it("can read the index", function() {
return this.repository.index().then(function(index) {
assert.ok(index instanceof Index);
Expand Down

Back | FazBrowse Home | New Git URL