Git.framework Reference Library

GITRepo Class Reference

GITRepo Class Reference

Declared in GITRepo.h

Overview

The GITRepo class declares the programmatic interface to the repository.

Tasks

Properties

root

Path to the repository root.

@property NSString *root
Declared In
GITRepo.h

bare

Flag indicating if the repo is bare, accessor isBare.

@property BOOL bare
Declared In
GITRepo.h

refResolver

Refs Resolver for the repo.

@property GITRefResolver *refResolver
Declared In
GITRepo.h

Class Methods

repo

+ (GITRepo *)repo
Return Value

repository initialised at the current directory, or nil if an error occurred

Discussion

Returns a repository using the current working directory as the repository root.

See Also
Declared In
GITRepo.h

repoWithRoot:

+ (GITRepo *)repoWithRoot:(NSString *)theRoot
Parameters
theRoot

Path to the repository root

Return Value

repository initialised at the specified path, or nil if an error occurred

Discussion

Returns a repository with theRoot as the repository root.

See Also
Declared In
GITRepo.h

repoWithRoot:error:

+ (GITRepo *)repoWithRoot:(NSString *)theRoot error:(NSError **)theError
Parameters
theRoot

Path to the repository root

theError

NSError describing any errors which occurred during initialisation

Return Value

repository initialised at the specified path, or nil if an error occurred

Discussion

Returns a repository with theRoot as the repository root.

See Also
Declared In
GITRepo.h

createRepoAtPath:

+ (GITRepo *)createRepoAtPath:(NSString *)path
Parameters
path

Path at which to create the repository. A bare repository is created if path ends in .git.

Return Value

repository created at the path

Discussion

Creates a repository at the specified path.

Declared In
GITRepo.h

createRepoAtPath:error:

+ (GITRepo *)createRepoAtPath:(NSString *)path error:(NSError **)error
Parameters
path

Path at which to create the repository. A bare repository is created if path ends in .git.

error

NSError describing the error which occurred during creation or initialisation.

Return Value

repository created at the path

Discussion

Creates a repository at the specified path.

Declared In
GITRepo.h

Instance Methods

initWithRoot:

- (id)initWithRoot:(NSString *)theRoot
Parameters
theRoot

Path to the repository root

Return Value

repository initialised at the specified path, or nil if an error occurred

Discussion

Returns a repository initialised with the root specified by theRoot.

See Also
Declared In
GITRepo.h

initWithRoot:error:

- (id)initWithRoot:(NSString *)theRoot error:(NSError **)theError
Parameters
theRoot

Path to the repository root

theError

NSError describing the error which occurred during initialisation

Return Value

repository initialised at the specified path, or nil if an error occurred

Discussion

Returns a repository initialised with the root specified by theRoot.

If the path specified by theRoot ends in ".git" then the repository is assumed to be a bare repository, if it doesn't then ".git" is appended to theRoot as a path component. The directory at the path specified is subjected to the following tests

  • the path specified exists and is a directory

  • the path specified is both readable and writable by the current user

  • the path looks like a git directory, ie has a certain structure and files

provided the path specified passes these tests then the repository object is returned. If any fail then nil is returned and the NSError is filled with details.

Declared In
GITRepo.h

initAtPath:

- (id)initAtPath:(NSString *)path
Parameters
path

Path at which to create the repository. A bare repository is created if path ends in .git.

Return Value

repository created at the path

Discussion

Creates a repository at the specified path.

Declared In
GITRepo.h

initAtPath:error:

- (id)initAtPath:(NSString *)path error:(NSError **)error
Parameters
path

Path at which to create the repository. A bare repository is created if path ends in .git.

error

NSError describing the error which occurred during creation or initialisation.

Return Value

repository created at the path

Discussion

Creates a repository at the specified path.

Declared In
GITRepo.h

branches

- (NSArray *)branches
Return Value

array of branches from the receiver

Discussion

Returns an array containing branches from the receiver.

The GITBranch objects in the array are created from the array of GITRef objects returned by headRefs (GITRefResolver) processing of refs/heads.

See Also
Declared In
GITRepo.h

remoteBranches

- (NSArray *)remoteBranches
Return Value

array of remotes from the receiver

Discussion

Returns an array containing remotes from the receiver.

The GITRemote objects in the array are created from the array of GITRef objects returned by remoteRefs (GITRefResolver) processing of refs/remotes.

See Also
Declared In
GITRepo.h

tags

- (NSArray *)tags
Return Value

array of tags from the receiver

Discussion

Returns an array containing tags from the receiver.

The GITTag objects in the array are created from the array of GITRef objects returned by tagRefs (GITRefResolver) processing of refs/tags.

See Also
Declared In
GITRepo.h

objectWithSha1:error:

- (GITObject *)objectWithSha1:(GITObjectHash *)objectHash error:(NSError **)error
Parameters
objectHash

Hash identifying the object to retrieve

error

NSError describing any errors which occur

Return Value

object identified by objectHash or nil if it can't be found or an error occurred

Discussion

Returns the GITObject identified by the objectHash.

Attempts to load the object from the file system first, if this fails then it turns to the packCollection to attempt loading from the repositories PACK files.

Declared In
GITRepo.h

enumerator

- (GITCommitEnumerator *)enumerator
Return Value

enumerator object from the HEAD of the reciever

Discussion

Returns an enumerator object from the HEAD of the receiver.

See Also
Declared In
GITRepo.h

enumeratorWithMode:

- (GITCommitEnumerator *)enumeratorWithMode:(GITCommitEnumeratorMode)mode
Parameters
mode

Enumerator mode to be used by the returned enumerator

Return Value

enumerator object from the HEAD of the receiver with the given mode

Discussion

Returns an enumerator object from the HEAD of the receiver with the given mode.

See Also
Declared In
GITRepo.h

revList

- (GITRevList *)revList
Return Value

RevList object based on the HEAD of the receiver.

Discussion

Returns a RevList object based on the HEAD of the receiver.

See Also
Declared In
GITRepo.h

revListFromCommit:

- (GITRevList *)revListFromCommit:(GITCommit *)head
Return Value

RevList object based on the given head.

Discussion

Returns a RevList object based on the given head.

See Also
Declared In
GITRepo.h

revListSortedByDate

- (NSArray *)revListSortedByDate
Return Value

array of commits sorted by date

Discussion

Returns an array of commit objects sorted by their commit date.

The result of this method is equivalent to git rev-list HEAD.

Bug

Use [[repo revList] arrayOfCommitsSortedByDate] instead

See Also
Declared In
GITRepo.h

revListSortedByTopology

- (NSArray *)revListSortedByTopology
Return Value

array of commits sorted by topology

Discussion

Returns an array of commit objects sorted by topology.

The result of this method is equivalent to git rev-list --topo-order HEAD.

Bug

Use [[repo revList] arrayOfCommitsSortedByTopology] instead

See Also
Declared In
GITRepo.h

revListSortedByTopologyAndDate

- (NSArray *)revListSortedByTopologyAndDate
Return Value

array of commits sorted by topology and date

Discussion

Returns an array of commit objects sorted by topology and commit date.

The result of this method is equivalent to git rev-list --date-order HEAD.

Bug

Use [[repo revList] arrayOfCommitsSortedByTopologyAndDate] instead

See Also
Declared In
GITRepo.h

Last updated: 2011-2-20