Skip to content

Commit 757df47

Browse files
author
John Haley
committed
Update Repository.prototype.getReferences to use changed libgit2 enum
1 parent 1ee3663 commit 757df47

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
343343
// references such as branches, tags and remote references (everything in
344344
// the .git/refs directory).
345345

346-
return repo.getReferenceNames(nodegit.Reference.TYPE.ALL);
346+
return repo.getReferenceNames(nodegit.Reference.TYPE.LISTALL);
347347
})
348348

349349
.then(function(referenceNames) {

lib/repository.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Repository.getReferences = function(repo, type, refNamesOnly, callback) {
153153
refList.forEach(function(refName) {
154154
refFilterPromises.push(Reference.lookup(repo, refName)
155155
.then(function(ref) {
156-
if (type == Reference.TYPE.ALL || ref.type() == type) {
156+
if (type == Reference.TYPE.LISTALL || ref.type() == type) {
157157
if (refNamesOnly) {
158158
filteredRefs.push(refName);
159159
return;
@@ -164,6 +164,9 @@ Repository.getReferences = function(repo, type, refNamesOnly, callback) {
164164
resolvedRef.repo = repo;
165165

166166
filteredRefs.push(resolvedRef);
167+
})
168+
.catch(function() {
169+
// If we can't resolve the ref then just ignore it.
167170
});
168171
}
169172
else {

0 commit comments

Comments
 (0)