Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap represents a bitmap as used in a packfile .bitmap file.
type BitmapCommit ¶
BitmapCommit represents a bitmapped commit, i.e. a commit in the packfile plus a bitmap indicating which objects are reachable from that commit.
type Index ¶
type Index struct { // ID is the packfile ID. For pack-123abc.idx, this would be 123abc. ID string // Objects holds the list of objects in the packfile in index order, i.e. sorted by OID Objects []*Object // Objects holds the list of objects in the packfile in packfile order, i.e. sorted by packfile offset PackfileOrder []*Object *IndexBitmap // contains filtered or unexported fields }
Index is an in-memory representation of a packfile .idx file.
func ReadIndex ¶
ReadIndex opens a packfile .idx file and loads its contents into memory. In doing so it will also open and read small amounts of data from the .pack file itself.
func (*Index) BuildPackfileOrder ¶
func (idx *Index) BuildPackfileOrder()
BuildPackfileOrder populates the PackfileOrder field.
func (*Index) LabelObjectTypes ¶
LabelObjectTypes tries to label each object in the index with its object type, using the packfile bitmap. Returns an error if there is no packfile .bitmap file.
func (*Index) LoadBitmap ¶
LoadBitmap opens the .bitmap file corresponding to idx and loads it into memory. Returns an error if there is no .bitmap.
type IndexBitmap ¶
type IndexBitmap struct { Commits *Bitmap Trees *Bitmap Blobs *Bitmap Tags *Bitmap // contains filtered or unexported fields }
IndexBitmap is the in-memory representation of a .bitmap file.
func (*IndexBitmap) BitmapCommit ¶
func (ib *IndexBitmap) BitmapCommit(i int) (*BitmapCommit, error)
BitmapCommit retrieves a bitmap commit, along with its bitmap. If the bitmap is XOR-compressed this will decompress it.
func (*IndexBitmap) NumBitmapCommits ¶
func (ib *IndexBitmap) NumBitmapCommits() int
NumBitmapCommits returns the number of indexed commits in the .bitmap file.
type Object ¶
type Object struct { OID string Type ObjectType Offset uint64 }
Object represents a Git packfile index entry, optionally decorated with its object type.
type ObjectType ¶
type ObjectType byte
ObjectType is used to label index entries as commits, trees, blobs or tags.
const ( // TUnknown is a sentinel indicating an object has not been labeled yet TUnknown ObjectType = iota // TBlob means Git blob TBlob // TCommit means Git commit TCommit // TTree means Git tree TTree // TTag means Git tag TTag )