Git.framework Reference Library

GITPackIndex Class Reference

GITPackIndex Class Reference

Declared in GITPackIndex.h

Overview

The GITPackIndex class cluster provides access to the PACK index files for looking up SHA1 object hashes when extracting GIT Objects from PACK files.

Current features of the PACK Index object include;

Tasks

Class Methods

packIndexWithPath:error:

+ (id)packIndexWithPath:(NSString *)indexPath error:(NSError **)error
Parameters
indexPath

Path to the index file

error

NSError describing the error that occurred

Return Value

autoreleased index file object or nil on error

Discussion

Creates an autoreleased Index file object with the specified path.

See Also
Declared In
GITPackIndex.h

Instance Methods

initWithPath:error:

- (id)initWithPath:(NSString *)indexPath error:(NSError **)error
Parameters
indexPath

Path to the index file

error

NSError describing the error that occurred

Return Value

index file object or nil on error

Discussion

Initialise the Index file with the provided path.

See Also
Declared In
GITPackIndex.h

initWithData:error:

- (id)initWithData:(NSData *)indexData error:(NSError **)error
Parameters
indexData

NSData object of the index file data

error

NSError describing the error that occurred

Return Value

index file object or nil on error

Discussion

Initialise the Index file with the provided data.

Declared In
GITPackIndex.h

version

- (NSUInteger)version
Return Value

Integer version of the index file

Discussion

Returns the version of the index file.

Declared In
GITPackIndex.h

fanoutTable

- (NSArray *)fanoutTable
Return Value

contents of the receivers fanout table or nil if an error occurred

Discussion

Returns the contents of the receivers fanout table.

See Also
Declared In
GITPackIndex.h

fanoutTable:

- (NSArray *)fanoutTable:(NSError **)error
Parameters
error

NSError describing the error which occurred

Return Value

contents of the receivers fanout table or nil if an error occurred

Discussion

Returns the contents of the receivers fanout table.

The fanout table consists of one entry per byte value (0-255). The entry value indicates the number of SHA1 hashes stored in the Index file which have a first byte which is less than or equal to the entry index. The contents of the fanout table are used to determine a bounding box of index positions within the main index table in which a SHA1 index entry will exist.

If the offset fanout table is corrupted a GITPackIndexErrorCorrupt NSError will be returned through the passed error.

See Also
Declared In
GITPackIndex.h

numberOfObjects

- (NSUInteger)numberOfObjects
Return Value

number of objects stored in the PACK file

Discussion

Returns the number of objects stored in the PACK file.

See Also
Declared In
GITPackIndex.h

indexOfSha1:

- (NSUInteger)indexOfSha1:(GITObjectHash *)objectHash
Parameters
objectHash

Object hash to find the index of

Return Value

index position of the entry in the main index table

Discussion

Returns the index position of the entry for the object has in the main index table.

Uses a binary search of the main index table bounded by the range given by the fanout table.

Declared In
GITPackIndex.h

packOffsetAtIndex:

- (off_t)packOffsetAtIndex:(NSUInteger)idx
Parameters
idx

Index position of the offset to retrieve

Return Value

the offset from the entry at the specified index position

Discussion

Returns the offset from the entry in the index table at the specified idx.

See Also
Declared In
GITPackIndex.h

packOffsetForSha1:

- (off_t)packOffsetForSha1:(GITObjectHash *)objectHash
Parameters
objectHash

Object hash to find the PACK offset of

Return Value

the PACK offset where data of the object can be retrieved or NSNotFound on error

Discussion

Returns the offset in the PACK file where the object data can be retrieved.

See Also
Declared In
GITPackIndex.h

packOffsetForSha1:error:

- (off_t)packOffsetForSha1:(GITObjectHash *)objectHash error:(NSError **)error
Parameters
objectHash

Object hash to find the PACK offset of

error

NSError describing the error which occurred

Return Value

the PACK offset where data of the object can be retrieved or NSNotFound on error

Discussion

Returns the offset in the PACK file where the object data can be retrieved.

If the object cannot be found in the Index file then a GITPackErrorObjectNotFound error is returned via the error argument.

See Also
Declared In
GITPackIndex.h

fanoutEntryForShasStartingWithByte:

- (GITFanoutEntry)fanoutEntryForShasStartingWithByte:(uint8_t)byte
Parameters
byte

The byte corresponding to the fanout entry

Return Value

A fanout entry for the SHA starting with the specified byte

Discussion

Returns a fanout entry for SHA starting with the specified byte.

See Also
Declared In
GITPackIndex.h

Last updated: 2011-2-20