ipld / js-ipld-git

MIT License
34 stars 11 forks source link

gitType in tree #22

Closed alanshaw closed 6 years ago

alanshaw commented 6 years ago

tree expects the node to always have a gitType but in the test data I'm working with (z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE) not all the linked objects have that property?

Is the test data incorrect?

daviddias commented 6 years ago

@magik6k you are our resident Git IPLD expert, could you answer @alanshaw's question?

magik6k commented 6 years ago

gitType is only set for commits/tags (to commit/tag string). Blobs are represented by a js blob. For tree objects it's either not present or it's an object (like other tree entries).

Doesn't default switch case work for that: https://github.com/ipld/js-ipld-git/blob/master/src/resolver.js#L126?

alanshaw commented 6 years ago

This turned out to be a problem in the code I'm using not an issue here. Sorry!