- java.lang.Object
-
- org.eclipse.jgit.lib.RefWriter
-
public abstract class RefWriter extends Object
Writes out refs to theConstants.INFO_REFSandConstants.PACKED_REFSfiles. This class is abstract as the writing of the files must be handled by the caller. This is because it is used by transport classes as well.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidwriteFile(String file, byte[] content)Handles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport.voidwriteInfoRefs()Rebuild theConstants.INFO_REFS.voidwritePackedRefs()Rebuild theConstants.PACKED_REFSfile.
-
-
-
Constructor Detail
-
RefWriter
public RefWriter(Collection<Ref> refs)
Constructor for RefWriter.
- Parameters:
refs- the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.
-
RefWriter
public RefWriter(Map<String,Ref> refs)
Constructor for RefWriter.
- Parameters:
refs- the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.
-
-
Method Detail
-
writeInfoRefs
public void writeInfoRefs() throws IOExceptionRebuild theConstants.INFO_REFS.This method rebuilds the contents of the
Constants.INFO_REFSfile to match the passed list of references.- Throws:
IOException- writing is not supported, or attempting to write the file failed, possibly due to permissions or remote disk full, etc.
-
writePackedRefs
public void writePackedRefs() throws IOExceptionRebuild theConstants.PACKED_REFSfile.This method rebuilds the contents of the
Constants.PACKED_REFSfile to match the passed list of references, including only those refs that have a storage type ofRef.Storage.PACKED.- Throws:
IOException- writing is not supported, or attempting to write the file failed, possibly due to permissions or remote disk full, etc.
-
writeFile
protected abstract void writeFile(String file, byte[] content) throws IOException
Handles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport.- Parameters:
file- path to ref file.content- byte content of file to be written.- Throws:
IOException
-
-