libgit2 / libgit2/libgit2sharp

Default commit order produces incorrectly arranged commits if commit date/time is the same

Open
#1,975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

By default when you pick up commits using function like this:

repo.Commits.ToArray()

Commits are organized by date time - and if it happens to be the same for two commits, they get randomly re-ordered.

Better query is like this:

repo.Commits.QueryBy(new CommitFilter() { SortBy = CommitSortStrategies.Topological }).ToArray()

Why this cannot be default just to avoid re-arrange problems ?

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 tracing repo.Commits and CommitFilter, including CommitSortStrategies.Topological, to find how the default commit ordering is selected. Check how equal commit dates are handled and add coverage for that case; done means the default result does not randomly reorder commits with identical dates.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.