Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

Commit

Permalink
Fix repo.tags for a repo with no refs.
Browse files Browse the repository at this point in the history
For example, in my repo the git dir 'packed-refs' file looks like this:

    # pack-refs with: peeled
    dd1133c99ec2a0372e630249f36996f772df0953 refs/heads/master

In that case `Git.refs` returns the empty string.
  • Loading branch information
trentm committed Jul 24, 2011
1 parent e889a08 commit 1889a37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/git/tag.js
Expand Up @@ -20,6 +20,7 @@ Tag.find_all = function(repo, options, callback) {
// Let's fetch the references
repo.git.refs({}, prefix('tag'), function(err, refs) {
if(err) return callback(err, refs);
if(!refs) return callback(null, []);
// Map the references
var mapped_refs = refs.split(/\n/).map(function(ref) {
// Fetch the name and id for the reference
Expand All @@ -37,4 +38,4 @@ Tag.find_all = function(repo, options, callback) {

callback(null, mapped_refs);
})
}
}

0 comments on commit 1889a37

Please sign in to comment.