nodegit/nodegit

Need to call `walker.start()` for `tree.walk()` not documented except in example

Open

#1.588 geöffnet am 20. Nov. 2018

Auf GitHub ansehen
 (3 Kommentare) (1 Reaktion) (0 zugewiesene Personen)JavaScript (5.502 Stars) (731 Forks)batch import
Good First IssueHelp Wanted

Beschreibung

System information

  • node version: v10.13.0
  • npm or yarn version: 6.4.1
  • OS/version/architecture: gLinux 64-bit (Google-internal, like Debian Testing)
  • Applicable nodegit version: v0.23.0 built from source

https://www.nodegit.org/api/tree/ has an example of how to use tree.walk(), but it doesn't mention a critical detail, which is mentioned in an example: https://github.com/nodegit/nodegit/blob/1f84d31da984cb2c105bf669393438081eede8a9/examples/walk-tree.js#L22-L23

It looks like the start() method is added to the instance here: https://github.com/nodegit/nodegit/blob/1f84d31da984cb2c105bf669393438081eede8a9/lib/tree.js#L145-L146

It took me quite a while to work out what the problem was, looking at the EventEmitter documentation would not have helped. I'm not sure if subclassing from EventEmitter is a good idea, but having a TreeWalker class where the this is documented would have made it easier to discover.

Contributor Guide