Skip to content
This repository
Browse code

bugfix: Repo.init_bare & Repo.fork_bare

  • Loading branch information...
commit 24ed6ff229cf037f37148db608083fb6a036d7e8 1 parent c9e8387
▟ ▖▟ ▖ authored May 14, 2011
3  lib/git/git.js
@@ -450,7 +450,8 @@ Git.prototype.fs_mkdir = function(dir, callback) {
450 450
 // Initialize a new git repository (create physical setup)
451 451
 Git.prototype.init = function(options, callback) {
452 452
   var self = this;
453  
-  
  453
+  var arguments = Array.prototype.slice(arguments);
  454
+
454 455
   if(Object.keys(options).length == 0) {
455 456
     Repository.init(this.git_directory, callback);
456 457
   } else {
15  lib/git/repo.js
@@ -133,25 +133,26 @@ Repo.prototype.blob = function(id, callback) {
133 133
 //  options: is any additional options to the git init command
134 134
 //
135 135
 // Examples
136  
-//  Repo.init_bare('/var/git/myrepo.git')  
  136
+//  Repo.init_bare('/var/git/myrepo.git')
137 137
 //
138 138
 // Return repo (newly created repo)
139 139
 Repo.init_bare = function(path, git_options, repo_options, callback) {
140 140
   var args = Array.prototype.slice.call(arguments, 1);
141 141
   callback = args.pop();
142 142
   // Set variables to default values
143  
-  git_options = args.length ? args.shift() : {};  
  143
+  git_options = args.length ? args.shift() : {};
144 144
   repo_options = repo_options ? repo_options : {};
145 145
   // Set up bare option
146 146
   git_options['bare'] = true;
  147
+  repo_options['is_bare'] = true;
147 148
   // Create a git object
148 149
   var git = new Git(path);
149 150
   // Create the directory
150  
-  git.fs_mkdir('..', function(err, result) {
  151
+  git.fs_mkdir('', function(err, result) {
151 152
     if(err) return callback(err, result);
152 153
     git.init(git_options, function(err, git) {
153 154
       if(err) return callback(err, git);
154  
-      callback(null, new Repo(path, repo_options, callback));
  155
+      new Repo(path, repo_options, callback);
155 156
     })
156 157
   })
157 158
 }
@@ -171,13 +172,13 @@ Repo.prototype.fork_bare = function(path, options, callback) {
171 172
   options['shared'] = true;
172 173
   // Create a git object
173 174
   var git = new Git(path);
174  
-  git.fs_mkdir('..', function(err, result) {
  175
+  git.fs_mkdir('', function(err, result) {
175 176
     if(err) return callback(err, result);
176 177
     self.git.clone(options, self.path, path, function(err, result) {
177 178
       if(err) return callback(err, result);
178  
-      callback(null, new Repo(path, callback));
  179
+      new Repo(path, {is_bare:true}, callback);
179 180
     })
180  
-  })  
  181
+  })
181 182
 }
182 183
 
183 184
 // The diff from commit a to commit b, optionally restricted to the fiven file(s)

0 notes on commit 24ed6ff

Please sign in to comment.
Something went wrong with that request. Please try again.