java.lang.Object
org.eclipse.jgit.lib.PackedRefsWriter
- Direct Known Subclasses:
RefWriter
Writes out refs to
Constants.PACKED_REFS file by
computing and applying all the missing traits for optimized reads.- Since:
- 7.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<Ref>Refs to be written.protected final EnumSet<PackedRefsTrait>Traits that are applicable to the refs. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPackedRefsWriter(Collection<Ref> refs, EnumSet<PackedRefsTrait> traits) Constructor for PackedRefsWriter.PackedRefsWriter(Collection<Ref> refs, EnumSet<PackedRefsTrait> traits, RefDatabase refDb) Constructor for PackedRefsWriter. -
Method Summary
Modifier and TypeMethodDescriptionAccess the new refs after all the necessary traits were applied.protected abstract voidHandles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport.voidRebuild theConstants.INFO_REFS.voidRebuild theConstants.PACKED_REFSfile.
-
Field Details
-
refs
Refs to be written. -
traits
Traits that are applicable to the refs.
-
-
Constructor Details
-
PackedRefsWriter
public PackedRefsWriter(Collection<Ref> refs, EnumSet<PackedRefsTrait> traits, RefDatabase refDb) throws IOException Constructor for PackedRefsWriter.
- Parameters:
refs- the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.traits- traits that are applicable to the refs. If any traits are missing, they would be applied before writing, but the specified traits are not re-computed/checked.refDb- refDb where the packed-refs file should be written.- Throws:
IOException- if it is not able to peel any of the tags.- Since:
- 7.7
-
PackedRefsWriter
Constructor for PackedRefsWriter.
Stores the provided refs and traits without applying any missing traits. Intended for use by subclasses that manage trait application themselves.
- Parameters:
refs- the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.traits- traits that are applicable to the refs.
-
-
Method Details
-
writeInfoRefs
Rebuild 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
Rebuild 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.
-
asRefList
Access the new refs after all the necessary traits were applied.- Returns:
- refs with all the traits applied
-
writeFile
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- if an IO error occurred
-