feat: Command method to return the equivalent `git` command string
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 38/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- git, java
- Domaine
- api, developer-experience
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Java
- Étoiles
- 427
- Forks
- 116
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de eclipse-jgit/jgit
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
eclipse-jgit/jgit#329 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
eclipse-jgit/jgit#327 ·
-
Repository.create(boolean bare) should provide a no-arg overload that uses isBare()Peut-être à nouveau libre @hardikyadav12 l’a pris il y a 77 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
eclipse-jgit/jgit#297 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
eclipse-jgit/jgit#293 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
eclipse-jgit/jgit#288 ·
Toutes les issues de eclipse-jgit/jgit
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
constellation-app/constellation#2613 ·
Les mainteneurs répondent en général sous 2 jours
-
[JUKEBOW] Arrows can be stolenOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 69/100
Vakore/ZappierGames#334 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
IETF-Hackathon/pqc-certificates#369 ·
Les mainteneurs répondent en général sous 1 jour
-
? - Needs Triage bot_watch bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NVIDIA/cudf-spark-jni#5594 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100