### Class

# Ggit Repository

#### Description [src]

    class Ggit.Repository : Ggit.Native
      implements Gio.Initable {
      /* No available fields */
    }

Represents an existing git repository including all of it’s object contents.

#### Ancestors

- GgitNative
- GgitObjectFactoryBase
- GObject

#### Implements

- GInitable

#### Functions

###### ggit_repository_clone

Clones a new git repository in the given folder.

###### ggit_repository_discover

Looks for a git repository.

###### ggit_repository_discover_full

Looks for a git repository.

###### ggit_repository_init_repository

Creates a new git repository in the given folder.

###### ggit_repository_open

Open a git repository.

#### Instance methods

###### ggit_repository_add_remote_fetch

Adds a fetch refspec to the `remote`‘s configuration. Adds `refspec` to the fetch list in the configuration. No loaded remote instances will be affected.

###### ggit_repository_add_remote_push

Adds a push refspec to `remote`‘s configuration. Adds the given refspec to the push list in the configuration. No loaded remote instances will be affected.

###### ggit_repository_blame_file

Get a blame for a single file.

###### ggit_repository_checkout_head

Update files in the working tree to reflect the contents of current HEAD. If `options` is `NULL`, then the default checkout options will be used.

###### ggit_repository_checkout_index

Update files in the working tree to reflect the contents of the index. If `index` is `NULL`, then the current index of the repository will be used. If `options` is `NULL`, then the default checkout options will be used.

###### ggit_repository_checkout_tree

Update files in the working tree to reflect the contents of the specified commit, tag or tree object. If `tree` is `NULL`, then the current HEAD of the repository will be used. If `options` is `NULL`, then the default checkout options will be used.

###### ggit_repository_cherry_pick

Cherry pick the specified commit, making changes in the index and the working directory.

###### ggit_repository_cherry_pick_commit

Cherry-picks the given `commit` against the provided `our_commit`, producing and index that reflects the result of the cherry-pick.

###### ggit_repository_create_blob

Create a new blob and return a `GOutputStream` to write contents to the blob. This is an efficient way to create new blobs without copying data. The blob id can be obtained from the blob output stream using

# ggit_blob_output_stream_get_id, after you close the stream.

###### ggit_repository_create_blob_from_buffer

Write an in-memory buffer to the object database as a blob.

###### ggit_repository_create_blob_from_file

Write a file to the object database as a blob.

###### ggit_repository_create_blob_from_path

Write a path relative to the repository working directory to the object database as a blob.

###### ggit_repository_create_branch

Creates a new branch pointing at a target commit.

###### ggit_repository_create_commit

Create a new commit. If `update_ref` is not `NULL`, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.

###### ggit_repository_create_commit_buffer

Create a commit as with `git_commit_create()` but instead of writing it to the objectdb, write the contents of the object into a buffer.

###### ggit_repository_create_commit_from_ids

Create a new commit. If `update_ref` is not `NULL`, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.

###### ggit_repository_create_commit_with_signature

Given the unsigned commit object’s contents, its signature and the header field in which to store the signature, attach the signature to the commit and write it into the given repositoryCreate a new commit using the (if not NULL) signature key and type of key provided.

###### ggit_repository_create_index_entry_for_file

Create a new index entry. When `file` is not `NULL`, the path of the returned entry (#ggit_index_entry_get_path) is set to the path of `file` relative to the working directory of `repository`. The file must reside in the working directory of `repository`. The file related fields of the returned entry are also queried from this file (if the file exists).

###### ggit_repository_create_index_entry_for_path

Create a new index entry. When `path` is not `NULL`, the path of the returned entry (#ggit_index_entry_get_path) is set to `path`. The specified path can be either absolute or relative. In the case of an absolute path, the path must reside within the working directory of `repository`. The file related fields of the returned entry are also queried from this path (if the file exists).

###### ggit_repository_create_note

Adds a note for an object.

###### ggit_repository_create_reference

Creates a new object id reference.

###### ggit_repository_create_remote

Adds a remote with the default fetch refspec to the repository’s configuration.

###### ggit_repository_create_symbolic_reference

Creates a new symbolic reference.

###### ggit_repository_create_tag

Create a new tag object.

###### ggit_repository_create_tag_annotation

Creates a new annotated tag.

###### ggit_repository_create_tag_from_buffer

Create a new tag from a buffer describing the tag object. The buffer must be correctly formatted.

###### ggit_repository_create_tag_lightweight

Creates a new lightweight tag.

###### ggit_repository_create_tree_builder

Create a new tree builder.

###### ggit_repository_create_tree_builder_from_tree

Create a tree builder for initialized with `tree`. To create an empty tree builder, use #ggit_repository_create_tree_builder instead.

###### ggit_repository_delete_tag

Delete an existing tag reference by name.

###### ggit_repository_drop_stash

Removes a single stashed state from the stash list.

###### ggit_repository_enumerate_branches

Get a branch enumerator to enumerate over all branches of the specified `list_type` in `repository`.

###### ggit_repository_file_status

Gets the file status for a single file.

###### ggit_repository_file_status_foreach

Gathers file statuses and run a callback for each one.

###### ggit_repository_get_ahead_behind

Count the number of unique commits between two commit objects.

###### ggit_repository_get_attribute

Get the attribute value of the specified attribute for the given file.

###### ggit_repository_get_config

Get the config for a specific repository.

###### ggit_repository_get_default_notes_ref

Gets the default notes reference for `repository`. It defaults to “refs/notes/commits”.

###### ggit_repository_get_descendant_of

Check whether `com` mit is a descendant of `ancestor`. Note that if this function returns `FALSE`, an error might have occurred. If so, `error` will be set appropriately.

###### ggit_repository_get_head

Get and resolves the current HEAD reference of the repository. Note that the returned ref is already resolved (if HEAD is symbolic). If you want to retrieve the symbolic ref called HEAD, then use #ggit_repository_lookup_reference instead.

###### ggit_repository_get_index

Get the index for a specific repository.

###### ggit_repository_get_location

Get the gitdir location of the repository.

###### ggit_repository_get_submodule_status

Gets the status for a submodule. This looks at a submodule and tries to determine the status. It will return a combination of the `GGIT_SUBMODULE_STATUS` values. How deeply it examines the working directory to do this will depend on `ignore`.

###### ggit_repository_get_workdir

Gets the working directory of the repository.

###### ggit_repository_is_bare

Checks if `repository` is bare.

###### ggit_repository_is_empty

Checks if `repository` is empty.

###### ggit_repository_is_head_detached

Checks if `repository`‘s HEAD is detached.

###### ggit_repository_is_head_unborn

Checks if `repository`‘s HEAD is an orphan.

###### ggit_repository_list_remotes

Fill a list with all the remotes in `repository`.

###### ggit_repository_list_tags

Fill a list with all the tags in the `repository`.

###### ggit_repository_list_tags_match

Fill a list with all the tags in the `repository` matching the provided pattern. The pattern can use standard fnmatch syntax.

###### ggit_repository_lookup

Lookups a reference to one of the objects in the `repository`.

###### ggit_repository_lookup_blob

Lookups a branch by its name in a repository.

###### ggit_repository_lookup_branch

Lookups a branch by its name in a repository.

###### ggit_repository_lookup_commit

Lookups a branch by its name in a repository.

###### ggit_repository_lookup_reference

Lookups a reference by its name in `repository`. The returned `GgitRef` must be freed with g_object_unref().

###### ggit_repository_lookup_reference_dwim

Lookups a reference by its short name in `repository` applying the git precendence rules to the given shorthand to determine which reference the user is referring to. The returned `GgitRef` must be freed with g_object_unref().

###### ggit_repository_lookup_remote

Gets the remote called `name`.

###### ggit_repository_lookup_submodule

Lookups a submodule information by name or path. If the submodule does not exist, `NULL` is returned and a GGIT_ERROR_NOTFOUND error set.

###### ggit_repository_lookup_tag

Lookups a branch by its name in a repository.

###### ggit_repository_lookup_tree

Lookups a branch by its name in a repository.

###### ggit_repository_merge

Merges the given commit(s) into HEAD, writing the results into the working directory. Any changes are staged for commit and any conflicts are written to the index.

###### ggit_repository_merge_base

Find the merge base between two commits.

###### ggit_repository_merge_commits

Merge two commits creating a `GgitIndex` reflecting the result of the merge.

###### ggit_repository_merge_trees

Merge two trees creating a `GgitIndex` reflecting the result of the merge.

###### ggit_repository_note_foreach

Loop over all the notes within a specified namespace and issue a callback for each one. If `callback` returns a non-zero value, this will stop looping.

###### ggit_repository_path_is_ignored

Tests if the ignore rules apply to the path provided.

###### ggit_repository_read_note

Reads the note for an object.

###### ggit_repository_rebase_init

Initializes a rebase operation to rebase the changes in `branch` relative to `upstream` onto another branch. To begin the rebase process, call git_rebase_next(). When you have finished with this object, call g_object_unref().

###### ggit_repository_rebase_open

Opens an existing rebase that was previously started by either an invocation of `ggit_rebase_init()` or by another client.

###### ggit_repository_references_foreach

Gathers references and run a callback for each one.

###### ggit_repository_references_foreach_name

Gathers reference names and run a callback for each one.

###### ggit_repository_remove_note

Removes the note for an object.

###### ggit_repository_remove_remote

Removes `remote` from the `repository`.

###### ggit_repository_rename_remote

Rename the remote of `repository` from `name` to `new_name`.

###### ggit_repository_reset

Performs a reset of type `reset_type` on `repository` to `target`, or `error` will be set.

###### ggit_repository_reset_default

Update some entries in the index from the target commit tree. The scope of the updated entries is determined by the paths specified in `pathspecs`. Passing `NULL` in `target` will result in removing entries in the index matching the provided pathspecs.

###### ggit_repository_revert

Revert the given `commit` on top of the current working directory.

###### ggit_repository_revparse

Find an object, as specified by a revision string. See `man gitrevisions`, or the documentation for `git rev-parse` for information on the syntax accepted.

###### ggit_repository_save_stash

Saves the local modifications to a new stash. It returns the commit containing the stashed state. This commit is also the target of the direct reference refs/stash.

###### ggit_repository_set_head

No description available.

###### ggit_repository_set_head_detached

No description available.

###### ggit_repository_set_remote_url

Sets url for the `remote` from the `repository`.

###### ggit_repository_set_submodule_fetch_recurse

Sets the submodule.’name’.fetchRecurseSubmodules value for the submodule. This setting won’t affect any existing instances..

###### ggit_repository_set_submodule_ignore

Sets the ignore rule for the submodule in the configuration. This does not affect any currently-loaded instances..

###### ggit_repository_set_submodule_update

Sets the update rule for the submodule in the configuration. This setting won’t affect any existing instances.

###### ggit_repository_set_submodule_url

Sets the URL for the submodule in the configuration.

###### ggit_repository_set_workdir

Sets the working directory of the repository. If `update_gitlink` is set to `TRUE` “core.worktree” will be set in the config if workdir is not the parent of the .git directory).

###### ggit_repository_stash_foreach

Loops over all the stashed states and issue a callback for each one. If `callback` returns a non-zero value, this will stop looping.

###### ggit_repository_submodule_foreach

Gathers submodules and run a callback for each one.

###### ggit_repository_tag_foreach

Get all the tags in the repository and run the provided callback on each. If the callback returns something other than 0, the iteration will stop and `error` will be set.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

#### Properties

###### Ggit.Repository:clone-options

No description available.

###### Ggit.Repository:head

No description available.

###### Ggit.Repository:init

No description available.

###### Ggit.Repository:is-bare

No description available.

###### Ggit.Repository:location

No description available.

###### Ggit.Repository:url

No description available.

###### Ggit.Repository:workdir

No description available.

##### Properties inherited from GgitNative (1)

###### Ggit.Native:native

No description available.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GgitRepositoryClass {
      /* no available fields */
    }

The class structure for `GgitRepositoryClass`.