Class RefDirectoryRename
- java.lang.Object
-
- org.eclipse.jgit.lib.RefRename
-
- org.eclipse.jgit.internal.storage.file.RefDirectoryRename
-
class RefDirectoryRename extends RefRename
Rename any reference stored byRefDirectory
.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, torefs/heads/foo/bar
, which is stored inside a directory that happens to match the source name.
-
-
Field Summary
Fields Modifier and Type Field 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 backupobjId
into during the rename.-
Fields inherited from class org.eclipse.jgit.lib.RefRename
destination, source
-
-
Constructor Summary
Constructors Constructor Description RefDirectoryRename(RefDirectoryUpdate src, RefDirectoryUpdate dst)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RefUpdate.Result
doRename()
Do the actual renameprivate boolean
linkHEAD(RefUpdate target)
private static boolean
rename(java.io.File src, java.io.File dst)
private boolean
renameLog(RefUpdate src, RefUpdate dst)
-
Methods inherited from class org.eclipse.jgit.lib.RefRename
disableRefLog, getRefLogIdent, getRefLogMessage, getResult, needToUpdateHEAD, rename, setRefLogIdent, setRefLogMessage
-
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
refdb
private final RefDirectory refdb
-
objId
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.
-
tmp
private RefDirectoryUpdate tmp
A reference we backupobjId
into during the rename.
-
-
Constructor Detail
-
RefDirectoryRename
RefDirectoryRename(RefDirectoryUpdate src, RefDirectoryUpdate dst)
-
-
Method Detail
-
doRename
protected RefUpdate.Result doRename() throws java.io.IOException
Do the actual rename
-
rename
private static boolean rename(java.io.File src, java.io.File dst)
-
linkHEAD
private boolean linkHEAD(RefUpdate target)
-
-