feat: Command method to return the equivalent `git` command string
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- git, java
- Domínio
- api, developer-experience
Direção de pesquisa
Start by locating the *Command classes and how they represent their options and arguments; the issue does not name specific files or tests. Determine how command strings could cover the command types and support a caller-provided function; done means each command can expose its equivalent git invocation, with tests covering the formatting and callback behavior.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
I'd like a method on each *Command that either returns a string or passes the string to a caller-provided function.
The string should be the equivalent git command line invocation for the command.
Motivation
I'm writing automation, and I want to log the git operations the automation is performing. A natural way to do this is to log the operations as the equivalent git commands.
- The people reviewing the logs are familiar with git.
- In case of a problem it makes it easy to manually walk through the same operations the automation performed by copy/pasting the command.
Right now I'm doing this in Kotlin, and can do this with a lot of extension functions and some reflection to get at private properties. For example, for AddCommand:
inline fun <reified T : Any, R> T.getPrivateProperty(name: String): R? {
val field = this::class.java.getDeclaredField(name)
field.isAccessible = true
@Suppress("UNCHECKED_CAST")
return field.get(this) as R?
}
fun AddCommand.info(t: Terminal): AddCommand {
val update = if (getPrivateProperty<AddCommand, Boolean>("update") == true) " --update" else ""
val filePatterns = getPrivateProperty<AddCommand, Collection<String>>("filepatterns")
?.joinToString(" ")
t.info("- git add$update $filePatterns")
return this
}
and then the call site looks like this:
val t = Terminal()
git.add()
.setUpdate(false)
.addFilePattern("foo")
.info(t)
.call()
which (for my use case) prints
- git add foo
to the terminal when this runs. This is specific to my use case and isn't very general, which is why I suggest the JGit equivalent (if implemented) should take a caller-provided function which receives the command string and decides what to do with it.
Alternatives considered
No response
Additional context
No response
- Linguagem predominante
- Java
- Estrelas
- 427
- Forks
- 116
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um 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 eclipse-jgit/jgit
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
eclipse-jgit/jgit#329 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
eclipse-jgit/jgit#327 ·
-
Repository.create(boolean bare) should provide a no-arg overload that uses isBare()Talvez livre de novo @hardikyadav12 assumiu há 77 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
eclipse-jgit/jgit#297 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
eclipse-jgit/jgit#293 · 2 comentários ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
eclipse-jgit/jgit#288 ·
Todas as issues de eclipse-jgit/jgit
Issues semelhantes
-
? - Needs Triage bot_watch bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
NVIDIA/cudf-spark-jni#5594 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
Upgrade solr to 9.11.0Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
DataONEorg/dataone-indexer#390 ·