Expose TreeDefinition entry names
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Funcionalidade
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- csharp, git
- Domínio
- backend-api-design
Direção de pesquisa
Revise as APIs TreeDefinition e Tree para entender seu comportamento existente de adição, remoção, busca e enumeração. Determine se a alteração pretendida expõe os nomes das entradas ou oferece suporte à iteração completa do dicionário e, em seguida, verifique se os metadados podem ser inspecionados sem fazer commit de objetos temporários no ODB.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
TreeDefinition has kind of a weird API. You can add to it, remove from it, and get a specific item, but there's no way to get a list of the entries in the tree or the like. For that, you have to commit the TreeDefinition to the ODB to get a regular Tree back, which supports enumeration. This seems ridiculous, not to mention inefficient.
For a recent project, I wanted a way to pass around and modify (several times) tree metadata only, before committing the final version. TreeDefinition worked well for this... until I wanted to look at which entries were in it. I used the above mentioned workaround to convert TreeDefinitions into Trees when I wanted to read their entries. In practice, this was far too slow. Profiling revealed my application was spending 60% of its time writing temporary TreeDefinitions to the ODB. Plus, it was cluttering up the repo with temporary objects.
That led me to create this terrible hack just to be able to use TreeDefinition:
class TreeMetadata : TreeDefinition
{
private static readonly FieldInfo baseEntriesField = typeof(TreeDefinition)
.GetField("entries", BindingFlags.NonPublic | BindingFlags.Instance);
private readonly Dictionary<string, TreeEntryDefinition> baseEntries;
public IEnumerable<string> EntryNames => baseEntries.Keys;
public TreeMetadata()
{
baseEntries = baseEntriesField.GetValue(this) as Dictionary<string, TreeEntryDefinition>;
}
// Snip factory methods copy/pasted from TreeDefinition
}
Would you guys be open to changing the API in some way to make it more usable? I'm not opposed to submitting a PR for it.
Follow-on: is just exposing the entry dictionary keys enough, or should we support full blown dictionary iteration?
- Linguagem predominante
- C#
- Estrelas
- 3.5k
- Forks
- 925
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de libgit2/libgit2sharp
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
libgit2/libgit2sharp#2193 · 2 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
libgit2/libgit2sharp#2192 · 1 comentário ·
-
Website is down Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 20/100
libgit2/libgit2sharp#2191 · 2 reações ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
libgit2/libgit2sharp#2189 · 1 reação ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
libgit2/libgit2sharp#2187 · 2 comentários ·
Todas as issues de libgit2/libgit2sharp
Issues semelhantes
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
azurenoops/spin_agent#975 ·
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
SubtitleEdit/subtitleedit#15108 · 1 comentário ·
-
area/docs-content Bug pulumi/docs
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 94/100