libgit2 / libgit2/libgit2sharp

CommitLog order does not reflect order of commits.

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

还没有人认领这个 Issue。

主要语言
C#
星标
3.5k
派生
925
PR 合并指标
30 天内没有已合并 PR

描述

Hi!

I am currently working on an E2E test which involves creating many commits, I am running into some issues however.
The repository's commit log order is different compared to the order of commits I have made.

Reproduction steps
public LibGitRepositoryBuilder WithManyCommits(int numberOfCommits, string commitMessage)
{
    for (int i = 0; i < numberOfCommits; i++)
    {
        // Create & stage file.
        var filePath = Path.Combine(_repoPath, $"{Guid.NewGuid()}.txt");
        File.Create(filePath).Dispose();

        var relativeFilePathToRoot = Path.GetRelativePath(_repository.Info.WorkingDirectory, filePath);
        Commands.Stage(_repository, relativeFilePathToRoot);
        _repository.Commit($"{commitMessage}-{i}", new Signature("bot", "bot@noreply.com", DateTimeOffset.UtcNow), new Signature("bot", "bot@noreply.com", DateTimeOffset.UtcNow));
    }

    return this;
}

var repo = new LibGitRepositoryBuilder(path)
    .WithManyCommits(100, "Hello world")
    .Build();

Expected behavior
  • "Hello world-99"
  • "Hello world-98"
  • "Hello world-97"
  • ....
Actual behavior

CommitsLog incorrect order

Version of LibGit2Sharp (release number or SHA1)

0.30.0

Operating system(s) tested; .NET runtime tested

OS
Edition Windows 11 Pro for Workstations
Version 23H2
Installed on ‎22/‎02/‎2024
OS build 22631.3593
Experience Windows Feature Experience Pack 1000.22700.1003.0

.NET
.NET 8.0

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,使用所示的 LibGitRepositoryBuilder.WithManyCommits 示例重现排序问题,并检查 repository 提交日志的枚举方式。Issue 中没有指定源文件或测试,因此请先找到 CommitLog 实现和现有的日志测试。完成的标准是:按顺序创建的提交会按预期以最新的提交在前的顺序出现。

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

评估

技术栈
csharp, git
领域
devtools
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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