libgit2 / libgit2/libgit2sharp

Last Commit message per treeEntry

Aperta
#1,733 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
3.5k
Fork
925
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l’esempio di tree-entry e l’uso di _repository.Commits.QueryBy(item.Path), quindi esamina come vengono rappresentate le voci dell’albero e le query dei commit in LibGit2Sharp. Confronta l’ultimo SHA o messaggio del commit richiesto con il comportamento attualmente lento e con il fallimento su una sequenza vuota. Done dovrebbe definire un modo affidabile ed efficiente per associare ogni voce di file o cartella al suo ultimo commit rilevante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, git
Ambito
devtools
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.