Repository_Index - SwiftDocOrg/Git GitHub Wiki

Repository.Index

A repository index.

public final class Index

Inheritance

RandomAccessCollection

Nested Type Aliases

Element

public typealias Element = Entry

Properties

version

The index on-disk version.

var version:​ Int

Valid return values are 2, 3, or 4. If 3 is returned, an index with version 2 may be written instead, if the extension data in version 3 is not necessary.

owner

The repository for the index.

var owner:​ Repository

path

The file path to the repository index file.

var path:​ String!

entries

Returns a sequence of entries in the index.

var entries:​ AnySequence<Entry>

startIndex

var startIndex:​ Int

endIndex

var endIndex:​ Int

Methods

reload(force:​)

Update the contents of an existing index object in memory by reading from disk.

public func reload(force:​ Bool) throws

Parameters

  • force:​ If true, this performs a "hard" read that discards in-memory changes and always reloads the on-disk index data. If there is no on-disk version, the index will be cleared. If false, this does a "soft" read that reloads the index data from disk only if it has changed since the last time it was loaded. Purely in-memory index data will be untouched.

add(path:​force:​)

public func add(path:​ String, force:​ Bool = false) throws

add(paths:​update:​force:​disableGlobExpansion:​)

public func add(paths:[String], update:​ Bool = false, force:​ Bool = false, disableGlobExpansion:​ Bool = false) throws
⚠️ **GitHub.com Fallback** ⚠️