libgit2 / libgit2/pygit2

Suggestion: have repr(oid) be `Oid(hex='a1b2c3')` instead of `a1b2c3`

Open Beginner friendly
#1,494 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

I suggest to make the repr of Oid objects be:

Oid(hex='a1b2c3')

instead of

a1b2c3

I think that it's better if repr returns a valid python expression. It's clearer what the object is, and it makes it easier to reconstruct it.

I can probably submit a pull request if this is approved.

Thanks!
Noam

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python Oid implementation and its repr behavior, then inspect nearby tests for Oid string representations. Update the representation so it is a valid Oid(hex='...') expression and confirm the existing representation tests cover the new output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.