Permalink
Browse files

bugfix: Repo.init_bare & Repo.fork_bare

  • Loading branch information...
1 parent c9e8387 commit 24ed6ff229cf037f37148db608083fb6a036d7e8 @dodo dodo committed May 14, 2011
Showing with 10 additions and 8 deletions.
  1. +2 −1 lib/git/git.js
  2. +8 −7 lib/git/repo.js
View
@@ -450,7 +450,8 @@ Git.prototype.fs_mkdir = function(dir, callback) {
// Initialize a new git repository (create physical setup)
Git.prototype.init = function(options, callback) {
var self = this;
-
+ var arguments = Array.prototype.slice(arguments);
+
if(Object.keys(options).length == 0) {
Repository.init(this.git_directory, callback);
} else {
View
@@ -133,25 +133,26 @@ Repo.prototype.blob = function(id, callback) {
// options: is any additional options to the git init command
//
// Examples
-// Repo.init_bare('/var/git/myrepo.git')
+// Repo.init_bare('/var/git/myrepo.git')
//
// Return repo (newly created repo)
Repo.init_bare = function(path, git_options, repo_options, callback) {
var args = Array.prototype.slice.call(arguments, 1);
callback = args.pop();
// Set variables to default values
- git_options = args.length ? args.shift() : {};
+ git_options = args.length ? args.shift() : {};
repo_options = repo_options ? repo_options : {};
// Set up bare option
git_options['bare'] = true;
+ repo_options['is_bare'] = true;
// Create a git object
var git = new Git(path);
// Create the directory
- git.fs_mkdir('..', function(err, result) {
+ git.fs_mkdir('', function(err, result) {
if(err) return callback(err, result);
git.init(git_options, function(err, git) {
if(err) return callback(err, git);
- callback(null, new Repo(path, repo_options, callback));
+ new Repo(path, repo_options, callback);
})
})
}
@@ -171,13 +172,13 @@ Repo.prototype.fork_bare = function(path, options, callback) {
options['shared'] = true;
// Create a git object
var git = new Git(path);
- git.fs_mkdir('..', function(err, result) {
+ git.fs_mkdir('', function(err, result) {
if(err) return callback(err, result);
self.git.clone(options, self.path, path, function(err, result) {
if(err) return callback(err, result);
- callback(null, new Repo(path, callback));
+ new Repo(path, {is_bare:true}, callback);
})
- })
+ })
}
// The diff from commit a to commit b, optionally restricted to the fiven file(s)

0 comments on commit 24ed6ff

Please sign in to comment.