Permalink
Browse files

Fix a bug so that bare repos with and without refs will work.

  • Loading branch information...
1 parent 6b8f6a1 commit 3baa8e42fd2c93353e2ebf1574aeec12ba5857f6 @creationix committed Apr 14, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/git.js
View
@@ -130,7 +130,7 @@ function getHeadSha(callback) {
head = result.match(/^ref: (.*)\n$/)[1]
} catch (err) { groupCallback(err); return; }
fs.readFile(Path.join(gitDir, head), "ascii", function (err, result) {
- master = result;
+ master = result || null;
checkDone();
});
checkDone();
@@ -139,7 +139,7 @@ function getHeadSha(callback) {
// When they're both done, parse out the sha and return it.
function checkDone() {
// Make sure all files have been read
- if (!(head && packedRefs && master)) { return; }
+ if (!(head && packedRefs && typeof master !== 'undefined')) { return; }
// Parse the sha1 out of the files.
try {
if (master) {

0 comments on commit 3baa8e4

Please sign in to comment.