8000 Add offsets to bit flag comparisons for GTIndexEntryStatus by onecrayon · Pull Request #547 · libgit2/objective-git · GitHub
[go: up one dir, main page]

Skip to content

Add offsets to bit flag comparisons for GTIndexEntryStatus #547

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

Merged
merged 3 commits into from
Feb 1, 2016

Conversation

onecrayon
Copy link
Contributor

Are you sick of random minor pull requests from me yet? :-)

You'll note on line 81 of the same file that the flags_extended bit flag from libgit2 is shifted 16 bits left in order to combine it with the basic flags field into a single int. However, the comparisons were not shifted, and thus were improperly reporting statuses depending on the bits set in the NAMEMASK portion of the basic flags. This commit fixes the bug.

Incidentally, I have not come across any instances where the flags_extended are actually set (and it appears that they are not intended for external use, anyway). It might be worth considering deprecating this method to avoid confusion for future newbies to Objective-Git.

@joshaber joshaber self-assigned this Jan 30, 2016
@joshaber
Copy link
Member

Huh, that's a good catch! Would you be able to write a test that exercises that?

@onecrayon
Copy link
Contributor Author

That would be a trick, actually; I haven't been able to find any scenario in which the flags_extended field actually has any data in it, and I hesitate to write a test that assumes the check will fail (particularly since this method doesn't return a failure code, but improperly reports an existing flag by default).

If you know of a scenario where these are set, I'd be happy to help with a test, but so far as I can tell there's little reason to expose these methods in Objective-Git at all (the flags field only ever seems to have the NAMEMASK set, which I can't imagine is terribly useful for most applications anyway, and the staged flag never appears to be set, either; it's entirely possible that I'm just missing the applicability of them, of course, since my usage of Objective-Git has been fairly narrow so far).

@joshaber
Copy link
Member
joshaber commented Feb 1, 2016

Fair enough!

joshaber added a commit that referenced this pull request Feb 1, 2016
Add offsets to bit flag comparisons for GTIndexEntryStatus
@joshaber joshaber merged commit bc11b50 into libgit2:master Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0