Git

Represents an object which allows manipulating a Git repository.

Constructors

this
this(string path)

Create an object which allows manipulating a Git repository. Because the location of $GIT_DIR (the .git directory) is queried at construction, the repository must exist.

Members

Aliases

ObjectMultiWriter
alias ObjectMultiWriter = RefCounted!ObjectMultiWriterImpl
Undocumented in source.
ObjectReader
alias ObjectReader = RefCounted!ObjectReaderImpl
Undocumented in source.
ObjectWriter
alias ObjectWriter = RefCounted!ObjectWriterImpl
Undocumented in source.
RefWriter
alias RefWriter = RefCounted!RefWriterImpl
Undocumented in source.

Functions

check
bool check(string[] args)

Run a command, and return true if it succeeds.

createObjectReader
ObjectReader createObjectReader()

Spawn a cat-file process which can read git objects by demand.

createObjectWriter
ObjectWriter createObjectWriter(string type)
Undocumented in source. Be warned that the author may not have intended to support it.
createObjectWriter
ObjectMultiWriter createObjectWriter()

Spawn a hash-object process which can hash and write git objects on the fly.

createRefWriter
RefWriter createRefWriter()

Spawn a update-ref process which can update git refs on the fly.

exportCommit
void exportCommit(string commit, string path, ObjectReader reader, bool delegate(string) pathFilter)

Extract a commit's tree to a given directory

exportTree
void exportTree(TreeID treeHash, string path, ObjectReader reader, bool delegate(string) pathFilter)

Extract a tree to a given directory

getHistory
History getHistory(string[] extraArgs)

A convenience function which loads the entire Git history into a graph.

getObjects
Object[] getObjects(OID[] hashes)

Run a batch cat-file query.

importTree
TreeID importTree(string path, ObjectMultiWriter writer, bool delegate(string) pathFilter)

Import a directory tree into the object store, and return the new tree object's hash.

pipe
auto pipe(string[] args, Redirect redirect)

Run a command with pipe redirections. Return the pipes.

pipe
auto pipe(string[] args)
Undocumented in source. Be warned that the author may not have intended to support it.
query
string query(string[] args)

Run a command, and return its output, sans trailing newline.

run
void run(string[] args)

Run a command. Throw if it fails.

writeObjects
void writeObjects(Git.Object[] objects)

Batch-write the given objects to the database. The hashes are saved to the "hash" fields of the passed objects.

Static functions

repositoryNameFromURL
string repositoryNameFromURL(string url)

Tries to match the default destination of git clone.

Static variables

globalOptions
string[] globalOptions;

Global options to add to commandPrefix during construction.

Structs

Authorship
struct Authorship

A parsed Git author/committer line.

BlobID
struct BlobID
Undocumented in source.
CommitID
struct CommitID

Strong typed OIDs to distinguish which kind of object they identify.

History
struct History

A convenience function which loads the entire Git history into a graph.

OID
struct OID

Git object identifier (identifies blobs, trees, commits, etc.)

Object
struct Object

The parsed representation of a raw Git object.

ObjectMultiWriterImpl
struct ObjectMultiWriterImpl
Undocumented in source.
ObjectReaderImpl
struct ObjectReaderImpl

Spawn a cat-file process which can read git objects by demand.

ObjectWriterImpl
struct ObjectWriterImpl

Spawn a hash-object process which can hash and write git objects on the fly.

RefWriterImpl
struct RefWriterImpl

Spawn a update-ref process which can update git refs on the fly.

TreeID
struct TreeID
Undocumented in source.

Variables

commandPrefix
string[] commandPrefix;

The prefix to apply to all executed commands. Includes the "git" program, and all of its top-level options.

environment
string[string] environment;

The environment that commands will be executed with. This field and commandPrefix are populated at construction, but may be modified afterwards, before any operations.

gitDir
string gitDir;

The path to the repository's .git directory.

path
string path;

The path to the repository's work tree.

Meta