Disable save of global git config

Đang mở
#253 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
git, java
Lĩnh vực
database

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
427
Fork
116
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-jgit/jgit

Tất cả issue của eclipse-jgit/jgit

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.