Skip to content

Commit

Permalink
Fix reference error
Browse files Browse the repository at this point in the history
Calling git init returns with an error, that self is not defined.

Example code:

```javascript
var git = require('git');
var path = require('path');
var fs = require('fs');
var repo = path.join(__dirname, String(Math.random() * 10000));

fs.mkdir(repo, function () {
    var g = new git.Git(repo);
    g.init({}, function (err, result) {
	console.log(err, result);
    });
});
```
  • Loading branch information
Ajnasz authored and jankeromnes committed Feb 5, 2015
1 parent 123c54e commit 2787126
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/git/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ Repository.prototype.get_subtree = function(commit_sha, path, callback) {
Repository.init = function(dir, bare, callback) {
try {
var args = Array.prototype.slice.call(arguments, 0);
var self = this;
callback = args.pop();
dir = args.length ? args.shift() : true;
bare = args.length ? args.shift() : true;
Expand Down

0 comments on commit 2787126

Please sign in to comment.