Suggestion: better handling of `repo.set_head(pygit2.Commit)`
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
I have tried to emulate git checkout --detach <commit> in pygit2, to create detached HEAD checkout, and I did come up with the following rough equivalent (though the following does not uses transactions as git does):
rev = repo.revparse_single(commit_name)
repo.checkout_tree(rev)
repo.set_head(rev.id)
However when I tried to use simply repo.set_head(rev), I got the following error:
TypeError Traceback (most recent call last)
<ipython-input-35-9612528ec0ac> in <module>()
----> 1 repo.set_head(rev)
/usr/lib/python2.7/dist-packages/pygit2/repository.pyc in set_head(self, target)
293
294 # if it's a string, then it's a reference name
--> 295 err = C.git_repository_set_head(self._repo, to_bytes(target))
296 check_error(err)
297
TypeError: initializer for ctype 'char *' must be a cdata pointer, not _pygit2.Commit
It would be nice if pygit2.Commit object was automatically peeled, but if it is decided to be not good idea, then what it needs is more user-friendly error message than the one above.
pygit2 0.26.0
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en Repository.set_head del traceback de repository.py y compara el flujo mostrado de revparse_single, checkout_tree y C.git_repository_set_head. Comprueba en los tests o la documentación existentes cuáles son los tipos de destino aceptados; se considera terminado cuando el comportamiento de entrada de Commit esté resuelto y cubierto, incluido un mensaje de error claro si sigue sin estar soportado.
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
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100