libgit2 / libgit2/libgit2sharp
Last Commit message per treeEntry
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
Hi i dont know it is implemented now but i want retrieve treeeObject from repository with last commit message in which commit current file / folder was changed. I trying to solve this for 2 days but didnt find any usefull on forums or on docummentation here. Thanks for help.
Reproduction steps
what i tried
var xxx = tree[path];
// For tree
if (xxx.TargetType == TreeEntryTargetType.Tree)
{
foreach (var item in (Tree)xxx.Target)
{
var CommitMessages = _repository.Commits.QueryBy(item.Path);
string commitMessage = null;
if (CommitMessages != null)
{
commitMessage = CommitMessages.Take(1).Last().Commit.MessageShort;
}
treeObjects.Add(new TreeObject {
Name = item.Name,
Sha = item.Target.Sha,
Type = item.TargetType.ToString(),
Path = item.Path,
CommitMessage = commitMessage
});
}
}
But its very slow and not every time it return InvalidOperationException: Sequence contains no elements and its take too much time ... (17secs till error?)
Expected behavior
To retireive treeEntries with at least commit sha Or better with commit itself
Actual behavior
I can retireve treeEntries and then look for Commits but there is problem it stilll pulling tree in commit and it is so slow,
Version of LibGit2Sharp (release number or SHA1)
commit 8950f498511d9e4cc1756193682ac3bb08581166
Operating system(s) tested; .NET runtime tested
.Net core 3
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 tree-entry example and the use of _repository.Commits.QueryBy(item.Path), then review how tree entries and commit queries are represented in LibGit2Sharp. Compare the requested last commit SHA or message with the current slow behavior and the empty-sequence failure. Done should define a reliable, efficient way to associate each file or folder entry with its last relevant commit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100