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

Oid cleanups #322

Merged
merged 3 commits into from
Jan 24, 2014
Merged

Oid cleanups #322

merged 3 commits into from
Jan 24, 2014

Conversation

carlosmn
Copy link
Member

Python has built-in functions for getting strings out of objects, so let's make use of that instead of implementing our own attribute for it. While there, use the same function for repr() which makes for nicer playing around in the interactive console.

I tried using the __bytes__() built-in for the raw bytes as well, but there we hit a snag on python2 vs python3, where bytes() does something completely different. I wonder if we making Oid an iterable would solve this. I've left it out for now.

The second commit makes the way to access an object's id be .id instead of .oid. This was following a legacy convention in libgit2, and we now should only use "oid" when referring to the data type, and "id" for the object's attribute. This has shown a couple of places we missed in libgit2 (namely IndexEntry and Note) and I'll be sending a patch there.

Python has built-in functions to get a string representation of an
object id, so let's use that instead of using a custom attribute.
This looks like a left-over from the libgit2 misnaming. The current
consensus is that 'oid' is the data type and 'id' is the name of the
attribute.
Similar to the Object change, we should be using 'id' when referring to
the target's id.x
@jdavid jdavid merged commit 5410128 into libgit2:master Jan 24, 2014
@carlosmn carlosmn deleted the oid-str branch January 24, 2014 14:13
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.

None yet

2 participants