libgit2 / libgit2/pygit2

Replace members by getters

未关闭
#969 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
1.7k
派生
408
平均合并
2 天 57 分钟
30 天内合并 PR
7

描述

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)\

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从 src/utils.h 中的 MEMBER 和 RMEMBER 定义开始,然后检查它们在 src/diff.c、src/note.c 和 src/reference.c 中的使用情况。将列出的成员替换为 getter,同时保留文档中说明的属性并避免创建未使用的对象;验证受影响的绑定是否表现一致。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, python
领域
devtools
Issue 类型
重构
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。