`Index.add()` accepts files behind symlinks
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
Direção de pesquisa
Comece reproduzindo o comportamento relatado de Index.add() com um componente symlink que não seja o último, e depois compare-o com a rejeição do mesmo caminho por git-add. Verifique se Index.add_all() e IndexEntry se comportam de forma semelhante e analise o comportamento correspondente de libgit2. Considera-se concluído quando o tratamento esperado estiver estabelecido e coberto por um teste de regressão.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Hey.
Not sure whether this is a bug or considered valid (though probably strange) usage, but Index.add() - and presumably Index.add_all() as well as IndexEntry, too - accept paths where even non-final components are symbolic links, like in symlink-to-dir/some-non-dir-file.
git-add itself rejects these with an error like:
$ git add symlink-to-dir/some-non-dir-file
fatal: pathspec 'symlink-to-dir/some-non-dir-file' is beyond a symbolic link
The Index object even uses these pathnames and doesn't just resolve them:
list(r.index)
[<pygit2.index.IndexEntry path=symlink-to-dir/some-non-dir-file id=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 mode=33188>]
Creating a commit of that works, too.
Now the problem with such pathnames is that symlink-to-dir is not added as a symbolic link to the index (at least not automatically), instead it seems to behave as if there were a true directory of that name which contained the file, but which is then immediately gone after adding.
IMO hat leads to all kinds of unexpected stuff (which is probably the reason why git-add forbids it instead of e.g either resolving it or doing something else (like resolving it and adding the file under its real dir).
Maybe pygit2 should also reject these? Not sure what libgit2 does, though.
Cheers,
Chris.
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 408
- Merge médio
- 1d 15h
- PRs com merge (30d)
- 7
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o 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/pygit2
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
-
Feature Request: Support app-level temporary config overrides using libgit2's backend supprtTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
-
merge_bases not wrappedAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
Todas as issues de libgit2/pygit2
Issues semelhantes
-
[Bug]: Bedrock request metadata forwarding does not work for /embeddingsTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertabug llm translation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Arkansas 2025 tax is $1.70 high above $100,000 net taxable income ($3,809 + 3.9% rule)Talvez já em andamento @PavelMakarchuk assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
PolicyEngine/policyengine-us#9828 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
jellyfin/jellyfin-mpv-shim#800 ·
Mantenedores costumam responder em até 1 dia
-
skillfs: one malformed chat-log line aborts the entire skill-usage analysis (skill_usage_from_chat_logs.py)Talvez já em andamento @zjncs assumiu hoje. Abertacomponent:skillfs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
agentic-os-org/ANOLISA#6116 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
P4: low query
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
jeffknupp/association#336 ·