X Tutup
The Wayback Machine - https://web.archive.org/web/20200916181346/https://github.com/nodegit/nodegit/pull/1498
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return type for Reference.isHead (typed as boolean, but returns a number) #1498

Open
wants to merge 2 commits into
base: master
from

Conversation

@dsabanin
Copy link

dsabanin commented May 17, 2018

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.

dsabanin added 2 commits May 17, 2018
… 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.
@rcjsuen
Copy link
Member

rcjsuen commented May 18, 2018

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...

@dsabanin
Copy link
Author

dsabanin commented May 18, 2018

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.

@rcjsuen
Copy link
Member

rcjsuen commented May 18, 2018

@dsabanin For better or worse, we've changed API before. ;) Many functions have changed from synchronous to being asynchronous.

@implausible implausible force-pushed the nodegit:master branch from c345989 to c67b436 Aug 26, 2019
@implausible implausible force-pushed the nodegit:master branch from 2b7db46 to 69b010a Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.
X Tutup