libgit2 / libgit2/pygit2

Repository.merge_file_from_index - can't take a None as an argument

Abierto
#1,378 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
1.7k
Forks
408
Merge medio
2 d 57 min
PR fusionados (30 d)
7

Descripción

This is probably more of a libgit2 question but given that I am working on pygit2, I better start the conversation over here.

I am working on writing unit tests for Repository.merge_file_from_index. I want to add a test for a deleted file. The signature of the method provides for None as a valid argument:

    def merge_file_from_index(
        self,
        ancestor: typing.Union[None, IndexEntry],
        ours: typing.Union[None, IndexEntry],
        theirs: typing.Union[None, IndexEntry],
    ) -> str:

So I have this:

def test_merge_file_from_index(testrepo):
    hello_txt = testrepo.index["hello.txt"]

    # deleting the file on theirs
    res = testrepo.merge_file_from_index(hello_txt, hello_txt, None)
    assert res == ""

And I am getting this when I run the test:

>       raise GitError(message)
E       _pygit2.GitError: invalid argument: 'theirs'

Am I wrong in my understanding from the signature that None is a correct value?

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Lee pygit2/repository.py cerca de la línea 682 y ejecuta la prueba mostrada para Repository.merge_file_from_index. Comprueba si la implementación acepta None para el argumento theirs, tal como indica la firma; el trabajo estará terminado cuando el comportamiento y la prueba coincidan en el caso de un archivo eliminado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
git, python
Área
tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.