Replace members by getters
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Description
For consistency and better performance (not creating objects that may not be used).
$ grep MEMBER src/*
src/diff.c: MEMBER(DiffFile, id, T_OBJECT, "Oid of the item."),
src/diff.c: MEMBER(DiffFile, path, T_STRING, "Path to the entry."),
src/diff.c: MEMBER(DiffFile, raw_path, T_OBJECT, "Path to the entry (bytes)."),
src/diff.c: MEMBER(DiffFile, size, T_LONG, "Size of the entry."),
src/diff.c: MEMBER(DiffFile, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
src/diff.c: MEMBER(DiffFile, mode, T_USHORT, "Mode of the entry."),
src/diff.c: MEMBER(DiffDelta, status, T_UINT, "A GIT_DELTA_* constant."),
src/diff.c: MEMBER(DiffDelta, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
src/diff.c: MEMBER(DiffDelta, similarity, T_USHORT, "For renamed and copied."),
src/diff.c: MEMBER(DiffDelta, nfiles, T_USHORT, "Number of files in the delta."),
src/diff.c: MEMBER(DiffDelta, old_file, T_OBJECT, "\"from\" side of the diff."),
src/diff.c: MEMBER(DiffDelta, new_file, T_OBJECT, "\"to\" side of the diff."),
src/note.c: MEMBER(Note, id, T_OBJECT, "id of the note object."),
src/note.c: MEMBER(Note, annotated_id, T_OBJECT, "id of the annotated object."),
src/reference.c: MEMBER(RefLogEntry, oid_new, T_OBJECT, "New oid."),
src/reference.c: MEMBER(RefLogEntry, oid_old, T_OBJECT, "Old oid."),
src/reference.c: MEMBER(RefLogEntry, message, T_STRING, "Message."),
src/utils.h:#define MEMBER(type, attr, attr_type, docstr)\
src/utils.h:#define RMEMBER(type, attr, attr_type, docstr)\
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MEMBER and RMEMBER definitions in src/utils.h, then inspect their uses in src/diff.c, src/note.c, and src/reference.c. Replace the listed members with getters while preserving the documented attributes and avoiding creation of unused objects; verify the affected bindings behave consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100