class RefDirectoryRename extends RefRename
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.
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private ObjectId |
objId
The value of the source reference at the start of the rename.
|
private RefDirectory |
refdb |
private RefDirectoryUpdate |
tmp
A reference we backup
objId into during the rename. |
private boolean |
updateHEAD
True if HEAD must be moved to the destination reference.
|
destination, source
Constructor and Description |
---|
RefDirectoryRename(RefDirectoryUpdate src,
RefDirectoryUpdate dst) |
Modifier and Type | Method and Description |
---|---|
protected RefUpdate.Result |
doRename()
Do the actual rename
|
private boolean |
linkHEAD(RefUpdate target) |
private static boolean |
rename(java.io.File src,
java.io.File dst) |
private boolean |
renameLog(RefUpdate src,
RefUpdate dst) |
disableRefLog, getRefLogIdent, getRefLogMessage, getResult, needToUpdateHEAD, rename, setRefLogIdent, setRefLogMessage
private static final org.slf4j.Logger LOG
private final RefDirectory refdb
private ObjectId objId
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.
private boolean updateHEAD
private RefDirectoryUpdate tmp
objId
into during the rename.RefDirectoryRename(RefDirectoryUpdate src, RefDirectoryUpdate dst)
protected RefUpdate.Result doRename() throws java.io.IOException
private static boolean rename(java.io.File src, java.io.File dst)
private boolean linkHEAD(RefUpdate target)