nodegit
nodegit copied to clipboard
Fix return type for Reference.isHead (typed as boolean, but returns a number)
Both API docs and TypeScript typings say that Reference.isHead returns boolean, while in fact it's just a wrapper around Branch.isHead that returns 0 for false, 1 for true.
This change makes the code do what published API already says it does. Branch.isHead is correctly typed in API as returning number.
I wonder if it might make more sense to change Branch.isHead
to return true
or false
so that it's more intuitive instead of letting it return 0
or 1
...
I agree, but I'm not sure what the policy on API changes is. The Branch.isHead is behaving according to the published API, which has it as returning number.
@dsabanin For better or worse, we've changed API before. ;) Many functions have changed from synchronous to being asynchronous.