Package org.eclipse.jgit.lib
Class RefRename
java.lang.Object
org.eclipse.jgit.lib.RefRename
- Direct Known Subclasses:
DfsRefRename
,FileReftableDatabase.FileRefRename
,RefDirectoryRename
A RefUpdate combination for renaming a reference.
If the source reference is currently pointed to by HEAD
, then the
HEAD symbolic reference is updated to point to the new destination.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final RefUpdate
Update operation to create/overwrite the destination reference.private RefUpdate.Result
protected final RefUpdate
Update operation to read and delete the source reference. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Don't record this rename in the ref's associated reflog.protected abstract RefUpdate.Result
doRename()
Do the actual renameGet identity of the user making the change in the reflog.Get the message to include in the reflog.Get result of rename operationprotected boolean
Whether theConstants#HEAD
reference needs to be linked to the new destination name.rename()
Renamevoid
Set the identity of the user appearing in the reflog.void
setRefLogMessage
(String msg) Set the message to include in the reflog.
-
Field Details
-
source
Update operation to read and delete the source reference. -
destination
Update operation to create/overwrite the destination reference. -
result
-
-
Constructor Details
-
RefRename
Initialize a new rename operation.- Parameters:
src
- operation to read and delete the source.dst
- operation to create (or overwrite) the destination.
-
-
Method Details
-
getRefLogIdent
Get identity of the user making the change in the reflog.- Returns:
- identity of the user making the change in the reflog.
-
setRefLogIdent
Set the identity of the user appearing in the reflog.The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the rename occurs and the log record is written.
- Parameters:
pi
- identity of the user. If null the identity will be automatically determined based on the repository configuration.
-
getRefLogMessage
Get the message to include in the reflog.- Returns:
- message the caller wants to include in the reflog; null if the rename should not be logged.
-
setRefLogMessage
Set the message to include in the reflog.- Parameters:
msg
- the message to describe this change.
-
disableRefLog
public void disableRefLog()Don't record this rename in the ref's associated reflog. -
getResult
Get result of rename operation- Returns:
- result of rename operation
-
rename
Rename- Returns:
- the result of the new ref update
- Throws:
IOException
-
doRename
Do the actual rename- Returns:
- the result of the rename operation.
- Throws:
IOException
-
needToUpdateHEAD
Whether theConstants#HEAD
reference needs to be linked to the new destination name.- Returns:
- true if the
Constants#HEAD
reference needs to be linked to the new destination name. - Throws:
IOException
- the current value ofHEAD
cannot be read.
-