aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/resources/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-10 23:39:20 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-21 00:18:33 +0100
commit8eee800fb1853a9b73067fa875737bb3a117ec2c (patch)
tree5392136ad09aa6a8dfa3b4197043990d77937e20 /org.eclipse.jgit/resources/org
parent380f091fa5fa71f44368c0e8e58bb520ebc34ed7 (diff)
downloadjgit-8eee800fb1853a9b73067fa875737bb3a117ec2c.tar.gz
jgit-8eee800fb1853a9b73067fa875737bb3a117ec2c.zip
Acquire file lock "gc.pid" before running gc
Git guards gc by locking a lock file "gc.pid" before starting execution. The lock file contains the pid and hostname of the process holding the lock. Git tries to kill the process holding that lock if the lock file wasn't modified in the last 12 hours and was started from the same host. Teach JGit to acquire this lock before running gc but skip execution if another process already holds the lock. Killing the other process could be undesired if it's a long running application. If the lock file wasn't modified in the last 12 hours try to lock it and run gc if locking succeeds. Register a shutdown hook for the lock file to ensure it is cleaned up if the process is gracefully killed. Change-Id: I00b838dcbf4fb0d03863bf7a2cd86b743c6c6971
Diffstat (limited to 'org.eclipse.jgit/resources/org')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties4
1 files changed, 4 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 3c0f75710e..f9b0595080 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -137,6 +137,7 @@ classCastNotA=Not a {0}
cloneNonEmptyDirectory=Destination path "{0}" already exists and is not an empty directory
closed=closed
closeLockTokenFailed=Closing LockToken ''{0}'' failed
+closePidLockFailed=Closing lock file ''{0}'' failed
collisionOn=Collision on {0}
commandClosedStderrButDidntExit=Command {0} closed stderr stream but didn''t exit within timeout {1} seconds
commandRejectedByHook=Rejected by "{0}" hook.\n{1}
@@ -306,6 +307,7 @@ expectedReceivedContentType=expected Content-Type {0}; received Content-Type {1}
expectedReportForRefNotReceived={0}: expected report for ref {1} not received
failedAtomicFileCreation=Atomic file creation failed, number of hard links to file {0} was not 2 but {1}
failedCreateLockFile=Creating lock file {} failed
+failedPidLock=Failed to lock ''{0}'' guarding git gc
failedReadHttpsProtocols=Failed to read system property https.protocols, assuming it is not set
failedToConvert=Failed to convert rest: %s
failedToDetermineFilterDefinition=An exception occurred while determining filter definitions
@@ -325,6 +327,7 @@ flagIsDisposed={0} is disposed.
flagNotFromThis={0} not from this.
flagsAlreadyCreated={0} flags already created.
funnyRefname=funny refname
+gcAlreadyRunning=fatal: gc is already running on machine ''{0}'' pid {1}
gcFailed=Garbage collection failed.
gcTooManyUnpruned=Too many loose, unpruneable objects after garbage collection. Consider adjusting gc.auto or gc.pruneExpire.
headRequiredToStash=HEAD required to stash local changes
@@ -675,6 +678,7 @@ sslTrustAlways=Always skip SSL verification for this server from now on
sslTrustForRepo=Skip SSL verification for git operations for repository {0}
sslTrustNow=Skip SSL verification for this single git operation
sslVerifyCannotSave=Could not save setting for http.sslVerify
+stalePidLock=Lock file ''{0}'' is older than 12 hours and seems to be stale, lastModified: {1}, trying to lock it
staleRevFlagsOn=Stale RevFlags on {0}
startingReadStageWithoutWrittenRequestDataPendingIsNotSupported=Starting read stage without written request data pending is not supported
stashApplyConflict=Applying stashed changes resulted in a conflict