Class ReflogWriter
java.lang.Object
org.eclipse.jgit.internal.storage.file.ReflogWriter
Utility for writing reflog entries using the traditional one-file-per-log
format.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReflogWriter
(RefDirectory refdb) Create writer for ref directory.ReflogWriter
(RefDirectory refdb, boolean forceWrite) Create writer for ref directory. -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Create the log directories.private byte[]
encode
(ObjectId oldId, ObjectId newId, PersonIdent ident, String message) private FileOutputStream
getFileOutputStream
(File log) private ReflogWriter
Write the given entry information to the ref's loglog
(String refName, ReflogEntry entry) Write the given entry to the ref's log.Write the given ref update to the ref's log.static String
refLockFor
(String name) Get the ref name to be used for when locking a ref's log for rewriting.private boolean
shouldAutoCreateLog
(String refName)
-
Field Details
-
refdb
-
forceWrite
private final boolean forceWrite
-
-
Constructor Details
-
ReflogWriter
Create writer for ref directory.- Parameters:
refdb
- aRefDirectory
object.
-
ReflogWriter
Create writer for ref directory.- Parameters:
refdb
- aRefDirectory
object.forceWrite
- true to write to disk all entries logged, false to respect the repository's config and current log file status.
-
-
Method Details
-
refLockFor
Get the ref name to be used for when locking a ref's log for rewriting.- Parameters:
name
- name of the ref, relative to the Git repository top level directory (so typically starts with refs/).- Returns:
- the name of the ref's lock ref.
-
create
Create the log directories.- Returns:
- this writer.
- Throws:
IOException
-
log
Write the given entry to the ref's log.- Parameters:
refName
- aString
object.entry
- aReflogEntry
object.- Returns:
- this writer
- Throws:
IOException
-
log
public ReflogWriter log(String refName, ObjectId oldId, ObjectId newId, PersonIdent ident, String message) throws IOException Write the given entry information to the ref's log- Parameters:
refName
- ref nameoldId
- old object idnewId
- new object idident
- aPersonIdent
message
- reflog message- Returns:
- this writer
- Throws:
IOException
-
log
Write the given ref update to the ref's log.- Parameters:
update
- aRefUpdate
msg
- reflog messagederef
- whether to dereference symbolic refs- Returns:
- this writer
- Throws:
IOException
-
encode
-
getFileOutputStream
- Throws:
IOException
-
log
- Throws:
IOException
-
shouldAutoCreateLog
-