Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

pack-priv Class RefDirectoryRename

extends RefRename
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.SnapshottingRefDirectory.SnapshotRefDirectoryRename
Imports
java.io.File, .IOException, java.nio.file.AtomicMoveNotSupportedException, .StandardCopyOption, org.eclipse.jgit.lib.Constants, .ObjectId, .RefRename, .RefUpdate, .RefUpdate.Result, org.eclipse.jgit.revwalk.RevWalk, org.eclipse.jgit.util.FileUtils, org.slf4j.Logger, .LoggerFactory

Rename any reference stored by RefDirectory.

This class works by first renaming the source reference to a temporary name, then renaming the temporary name to the final destination reference.

This strategy permits switching a reference like refs/heads/foo, which is a file, to refs/heads/foo/bar, which is stored inside a directory that happens to match the source name.

Field Summary

Modifier and TypeField and Description
private static final Logger
private ObjectId
objId

The value of the source reference at the start of the rename.

private final RefDirectory
private RefDirectoryUpdate
tmp

A reference we backup objId into during the rename.

Inherited from org.eclipse.jgit.lib.RefRename:
destinationsource

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected RefUpdate.Result
doRename()

Implements abstract org.eclipse.jgit.lib.RefRename.doRename.

Do the actual rename

protected RefDirectory

Returns:

the ref directory.
getRefDirectory
()

Get the ref directory associated with this rename.

private boolean
private static boolean
rename(File src, File dst)

private boolean
Inherited from org.eclipse.jgit.lib.RefRename:
disableRefLoggetRefLogIdentgetRefLogMessagegetResultneedToUpdateHEADrenamesetRefLogIdentsetRefLogMessage

Field Detail

LOGback to summary
private static final Logger LOG
objIdback to summary
private ObjectId objId

The value of the source reference at the start of the rename.

At the end of the rename the destination reference must have this same value, otherwise we have a concurrent update and the rename must fail without making any changes.

refdbback to summary
private final RefDirectory refdb
tmpback to summary
private RefDirectoryUpdate tmp

A reference we backup objId into during the rename.

Constructor Detail

RefDirectoryRenameback to summary
pack-priv RefDirectoryRename(RefDirectoryUpdate src, RefDirectoryUpdate dst)

Method Detail

doRenameback to summary
protected RefUpdate.Result doRename() throws IOException

Implements abstract org.eclipse.jgit.lib.RefRename.doRename.

Doc from org.eclipse.jgit.lib.RefRename.doRename.

Do the actual rename

Returns:RefUpdate.Result

the result of the rename operation.

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
getRefDirectoryback to summary
protected RefDirectory getRefDirectory()

Get the ref directory associated with this rename.

Returns:RefDirectory

the ref directory.

linkHEADback to summary
private boolean linkHEAD(RefUpdate target)
renameback to summary
private static boolean rename(File src, File dst)
renameLogback to summary
private boolean renameLog(RefUpdate src, RefUpdate dst)