libgit2 / libgit2/libgit2sharp
CommitFilter / CommitSortStrategies Understanding
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am trying to understand what "CommitSortStrategies" is actually doing to the commit collections that I am getting back and am just looking for clarification if this is correct.
Git, by default (cmd line app), are shown in reverse chronological order, so:
- git (default sort) == CommitFilter/SortBy of (Undefined)
- git --reverse != CommitFilter/SortBy of Reverse
- git --reverse == CommitFilter/SortBy of Reverse | Time
- git --topo-order == CommitFilter/SortBy of Topological
- git --reverse --topo-order == CommitFilter/SortBy of Reverse | Topological
- git --______ ?= CommitFilter/SortBy of None
- CommitFilter/SortBy of None != CommitFilter/SortBy of (Undefined)
Is that list correct/complete?
(FYI: I have a multi-million object repo with millions of refs and have reverted to shelling to git to get the commit lists between cross-merge branches as I can not get a direct match between libgit2's ls-trees and gits, my head hurts....)
BTW: What order does CommitSortStrategies.None follow? Based on ref creation order on the file-system, maybe?
A sample for a future reader:
# Note: Piping to head as you can not use -n <number>, --max-count=<number> as that is applied before commit ordering
git log HEAD..master --format="%ci %h %s" --reverse | head -10
So based upon the equivalence list above, in libgit2sharp this becomes:
var filter = new CommitFilter {
SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Time,
Since = master, // determined by a prior repo.Lookup<Tree>
Until = head, // determined by a prior repo.Lookup<Tree>
};
repo.Commits.QueryBy(filter).Take(10);
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中引用的入口点 CommitFilter、CommitSortStrategies 和 QueryBy 开始,然后将它们的行为与列出的 git 命令示例进行比较。记录每个提出的等价关系是否正确,并明确 CommitSortStrategies.None 的排序语义;当这些问题都有权威解释时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git
- 领域
- devtools
- Issue 类型
- 文档
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100