Git.framework Reference Library

GITLooseObject Class Reference

GITLooseObject Class Reference

Declared in GITLooseObject.h

Overview

The GITLooseObject class aids in the extraction of objects from loose files.

The class combines the data of the object and the indicated type for later conversion into a normal git object type such as commit, tree, blob or tag.

When loading an object from the file system you create an instance of this class directly, this is opposed to the way in which is PACK counterpart GITPackObject is used.

Tasks

Properties

type

Type of the object the data represents.

@property GITObjectType type
Declared In
GITLooseObject.h

data

Data of the object.

@property NSData *data
Declared In
GITLooseObject.h

sha1

SHA1 hash of the object.

@property GITObjectHash *sha1
Declared In
GITLooseObject.h

length

Size of the receivers data.

@property NSUInteger length
Declared In
GITLooseObject.h

Class Methods

looseObjectWithSha1:from:error:

+ (GITLooseObject *)looseObjectWithSha1:(GITObjectHash *)objectHash from:(NSString *)directory error:(NSError **)error
Parameters
objectHash

Hash identifying the object to retrieve

directory

Directory to locate the object within

error

NSError describing any errors which occurred

Return Value

Loose object containing the type and data of the object or nil if not found or an error occurred

Discussion

Creates and returns a loose object identified by the objectHash from the directory specified.

Loads data from the file system for the object matching the objectHash. The object prefix is extracted from the loaded data to determine the object type of the data.

See Also
Declared In
GITLooseObject.h

Instance Methods

initWithSha1:from:error:

- (id)initWithSha1:(GITObjectHash *)objectHash from:(NSString *)directory error:(NSError **)error
Parameters
objectHash

Hash identifying the object to retrieve

directory

Directory to locate the object within

error

NSError describing any errors which occurred

Return Value

Loose object containing the type and data of the object or nil if not found or an error occurred

Discussion

Creates and returns a loose object identified by the objectHash from the directory specified.

Loads data from the file system for the object matching the objectHash. The object prefix is extracted from the loaded data to determine the object type of the data.

See Also
Declared In
GITLooseObject.h

objectInRepo:error:

- (GITObject *)objectInRepo:(GITRepo *)repo error:(NSError **)error
Parameters
repo

Repository the object should belong to

error

NSError describing any errors which occurred

Return Value

object in the repo

Discussion

Returns the object contained in the receiver and sets the repo of the object.

Declared In
GITLooseObject.h

Last updated: 2011-2-20