christkv/node-git

"no such sha found" error

perry-mitchell opened this issue · 2 comments

I'm constantly getting the "no such sha found" error in the get_raw_object_by_sha1 function. I'm using Node 0.12.4 and NPM 2.11.3. The error occurs on the last line of the method (183):

  // No results throw an error that no sha pack object was found
  throw "no such sha found";
}

I'm using version 0.1.5 from npm in a Grunt plugin, fetching tags from the remote repo. It's been working fine before I reinstalled my environment, and now it borks. My co-worker's copy still functions, but he's on Node 0.10.* and npm 2.5.*.

The code in the Grunt plugin that is making the request:

var repo = new Repo(options.git.projectDirectory, {}, function(err, r) {
    r.tags(function(err, tags) {
        var tagArr = [];
        for (var tagIndex in tags) {
            var tag = tags[tagIndex];
            tagArr.push(tag.name);
        }
        (callback)(tagArr);
    });
});

The callback function to r.tags is never called.

+1 - ran into this as well. Just tested it on node 0.10.40 and things work fine. Node 4.1.2 does not work.

Also, it's definitely a bug to throw a plain string. It should be throw new Error('no such sha found');

This problem still occurs. I'm using v6.3.1 and cannot fetch tags.