Disable save of global git config

Abierto
#253 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
git, java
Área
database

Línea de trabajo

The issue points to FileBasedConfig.save and FS$FileStoreAttributes.saveToConfig; begin by tracing how file-store attributes are persisted to the user config and how configuration saving is controlled. Add a way to prevent writes while retaining reads and in-memory changes, and verify that the immutable-config scenario no longer logs a failed-save error.

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

Descripción

Description

JGit attempts to automatically save the user's .gitconfig file but this is not always desirable. In our CI/CD environment we set .gitconfig as immutable (+i in linux) to prevent builds from changing settings that may effect other builds. JGit will log the following error when it attempts to save.

I would like to be able to disable saving so that we only read from the user config and potentially make in-memory only config changes but never modify the underlying user config file.

Cannot save config file 'FileBasedConfig[/home/jenkins/.gitconfig]'
java.io.IOException: Cannot commit write to /home/jenkins/.gitconfig
 	at org.eclipse.jgit.storage.file.FileBasedConfig.save(FileBasedConfig.java:258)
 	at org.eclipse.jgit.util.FS$FileStoreAttributes.saveToConfig(FS.java:584)
 	at org.eclipse.jgit.util.FS$FileStoreAttributes.lambda$0(FS.java:364)
 	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
 	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Motivation

Preventing saving of the user .gitconfig when using jgit.

Alternatives considered

None. The stack is printed to the logs but ignored.

Additional context

No response

Lenguaje dominante
Java
Estrellas
427
Forks
116
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

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.

Más de eclipse-jgit/jgit

Todos los issues de eclipse-jgit/jgit

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.