Class ReflogWriter
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.ReflogWriter
-
public class ReflogWriter extends java.lang.Object
Utility for writing reflog entries- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description ReflogWriter(Repository repository)
Create write for repositoryReflogWriter(Repository repository, boolean forceWrite)
Create write for repository
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReflogWriter
create()
Create the log directoriesRepository
getRepository()
Get repository that reflog is being written forReflogWriter
log(java.lang.String refName, ObjectId oldId, ObjectId newId, PersonIdent ident, java.lang.String message)
Write the given entry information to the ref's logReflogWriter
log(java.lang.String refName, ReflogEntry entry)
Write the givenReflogEntry
entry to the ref's logReflogWriter
log(RefUpdate update, java.lang.String msg, boolean deref)
Write the given ref update to the ref's logjava.io.File
logFor(java.lang.String name)
Locate the log file on disk for a single reference name.static java.lang.String
refLockFor(java.lang.String name)
Get the ref name to be used for when locking a ref's log for rewriting
-
-
-
Constructor Detail
-
ReflogWriter
public ReflogWriter(Repository repository)
Create write for repository- Parameters:
repository
-
-
ReflogWriter
public ReflogWriter(Repository repository, boolean forceWrite)
Create write for repository- Parameters:
repository
-forceWrite
- true to write to disk all entries logged, false to respect the repository's config and current log file status
-
-
Method Detail
-
refLockFor
public static java.lang.String refLockFor(java.lang.String name)
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
-
getRepository
public Repository getRepository()
Get repository that reflog is being written for- Returns:
- file repository
-
create
public ReflogWriter create() throws java.io.IOException
Create the log directories- Returns:
- this writer
- Throws:
java.io.IOException
-
logFor
public java.io.File logFor(java.lang.String name)
Locate the log file on disk for a single reference name.- Parameters:
name
- name of the ref, relative to the Git repository top level directory (so typically starts with refs/).- Returns:
- the log file location.
-
log
public ReflogWriter log(java.lang.String refName, ReflogEntry entry) throws java.io.IOException
Write the givenReflogEntry
entry to the ref's log- Parameters:
refName
-entry
-- Returns:
- this writer
- Throws:
java.io.IOException
-
log
public ReflogWriter log(java.lang.String refName, ObjectId oldId, ObjectId newId, PersonIdent ident, java.lang.String message) throws java.io.IOException
Write the given entry information to the ref's log- Parameters:
refName
-oldId
-newId
-ident
-message
-- Returns:
- this writer
- Throws:
java.io.IOException
-
log
public ReflogWriter log(RefUpdate update, java.lang.String msg, boolean deref) throws java.io.IOException
Write the given ref update to the ref's log- Parameters:
update
-msg
-deref
-- Returns:
- this writer
- Throws:
java.io.IOException
-
-