Class RefDirectoryUpdate
java.lang.Object
org.eclipse.jgit.lib.RefUpdate
org.eclipse.jgit.internal.storage.file.RefDirectoryUpdate
Updates any reference stored by
RefDirectory
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.RefUpdate
RefUpdate.Result
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RefUpdate.Result
doDelete
(RefUpdate.Result status) Do deleteprotected RefUpdate.Result
Do linkprotected RefUpdate.Result
doUpdate
(RefUpdate.Result status) Do updateprotected RefDirectory
Get the reference database this update modifies.protected Repository
Get the repository storing the database's objects.private String
toResultString
(RefUpdate.Result status) protected boolean
tryLock
(boolean deref) Try to acquire the lock on the reference.protected void
unlock()
Releases the lock taken byRefUpdate.tryLock(boolean)
if it succeeded.Methods inherited from class org.eclipse.jgit.lib.RefUpdate
delete, delete, disableRefLog, forceUpdate, getExpectedOldObjectId, getName, getNewObjectId, getOldObjectId, getPushCertificate, getRef, getRefLogIdent, getRefLogMessage, getResult, isDetachingSymbolicRef, isForceRefLog, isForceUpdate, isRefLogIncludingResult, link, setCheckConflicting, setDetachingSymbolicRef, setExpectedOldObjectId, setForceRefLog, setForceUpdate, setNewObjectId, setOldObjectId, setPushCertificate, setRefLogIdent, setRefLogMessage, update, update
-
Field Details
-
database
-
shouldDeref
private boolean shouldDeref -
lock
-
-
Constructor Details
-
RefDirectoryUpdate
RefDirectoryUpdate(RefDirectory r, Ref ref)
-
-
Method Details
-
getRefDatabase
Get the reference database this update modifies.- Specified by:
getRefDatabase
in classRefUpdate
- Returns:
- the reference database this update modifies.
-
getRepository
Get the repository storing the database's objects.- Specified by:
getRepository
in classRefUpdate
- Returns:
- the repository storing the database's objects.
-
tryLock
Try to acquire the lock on the reference.If the locking was successful the implementor must set the current identity value by calling
RefUpdate.setOldObjectId(ObjectId)
.- Specified by:
tryLock
in classRefUpdate
- Parameters:
deref
- true if the lock should be taken against the leaf level reference; false if it should be taken exactly against the current reference.- Returns:
- true if the lock was acquired and the reference is likely protected from concurrent modification; false if it failed.
- Throws:
IOException
- the lock couldn't be taken due to an unexpected storage failure, and not because of a concurrent update.
-
unlock
protected void unlock()Releases the lock taken byRefUpdate.tryLock(boolean)
if it succeeded. -
doUpdate
Do update- Specified by:
doUpdate
in classRefUpdate
- Parameters:
status
- aRefUpdate.Result
object.- Returns:
result
- Throws:
IOException
-
toResultString
-
doDelete
Do delete- Specified by:
doDelete
in classRefUpdate
- Parameters:
status
- aRefUpdate.Result
object.- Returns:
result
- Throws:
IOException
-
doLink
Do link- Specified by:
doLink
in classRefUpdate
- Parameters:
target
- aString
object.- Returns:
RefUpdate.Result.NEW
on success.- Throws:
IOException
-