GgitIndex

GgitIndex

Properties

GFile * file Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GgitObjectFactoryBase
        ╰── GgitNative
            ╰── GgitIndex

Implemented Interfaces

GgitIndex implements GInitable.

Description

Functions

ggit_index_open ()

GgitIndex *
ggit_index_open (GFile *file,
                 GError **error);

Create a new bare Git index object as a memory representation of the Git index file in file , without a repository to back it.

Parameters

file

a GFile.

 

error

a GError for error reporting, or NULL.

 

Returns

a GgitIndex or NULL if an error occurred.

[transfer full]


ggit_index_read ()

gboolean
ggit_index_read (GgitIndex *idx,
                 gboolean force,
                 GError **error);

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

If force is 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 force is 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. Be aware: if there are changes on disk, unwritten in-memory changes are discarded.

Parameters

idx

a GgitIndex.

 

force

force read even if there are in-memory changes.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the index could be read from the file associated with the index, FALSE otherwise.


ggit_index_write ()

gboolean
ggit_index_write (GgitIndex *idx,
                  GError **error);

Write an existing index object from memory back to disk using an atomic file lock.

Parameters

idx

a GgitIndex.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the index was successfully written to disk, FALSE otherwise.


ggit_index_write_tree ()

GgitOId *
ggit_index_write_tree (GgitIndex *idx,
                       GError **error);

Write a new tree object to disk containing a representation of the current state of the index. The index must be associated to an existing repository and must not contain any files in conflict. You can use the resulting tree to for instance create a commit.

Parameters

idx

a GgitIndex.

 

error

a GError for error reporting, or NULL.

 

Returns

a GgitOId or NULL in case of an error.


ggit_index_remove ()

gboolean
ggit_index_remove (GgitIndex *idx,
                   GFile *file,
                   gint stage,
                   GError **error);

Remove a file from the index (specified by position).

Parameters

idx

a GgitIndex.

 

file

the file to search.

 

stage

the stage to search.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the file was successfully removed, FALSE otherwise.


ggit_index_add ()

gboolean
ggit_index_add (GgitIndex *idx,
                GgitIndexEntry *entry,
                GError **error);

Add a file to the index.

Parameters

idx

a GgitIndex.

 

entry

a GgitIndexEntry.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the file was successfully added, FALSE otherwise.


ggit_index_add_file ()

gboolean
ggit_index_add_file (GgitIndex *idx,
                     GFile *file,
                     GError **error);

Add a file to the index. The specified file must be in the working directory and must exist and be readable.

Parameters

idx

a GgitIndex.

 

file

file to add.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the file was added to the index or FALSE if there was an error.


ggit_index_add_path ()

gboolean
ggit_index_add_path (GgitIndex *idx,
                     const gchar *path,
                     GError **error);

Add a file to the index by path. You can specify both relative paths (to the working directory) and absolute paths. Absolute paths however must reside in the working directory. The specified path must exist and must be readable.

Parameters

idx

a GgitIndex.

 

path

path to the file to add.

 

error

a GError for error reporting, or NULL.

 

Returns

TRUE if the file was added to the index or FALSE if there was an error.


ggit_index_get_owner ()

GgitRepository *
ggit_index_get_owner (GgitIndex *idx);

Get the GgitRepository that owns the index.

Parameters

idx

a GgitIndex.

 

Returns

the GgitRepository that owns this index.

[transfer full]


ggit_index_get_entries ()

GgitIndexEntries *
ggit_index_get_entries (GgitIndex *idx);

Get the index entries enumerator.

Parameters

idx

a GgitIndex.

 

Returns

a GgitIndexEntries.

[transfer full]


ggit_index_get_entries_resolve_undo ()

GgitIndexEntriesResolveUndo *
ggit_index_get_entries_resolve_undo (GgitIndex *idx);

Get the resolve undo entries enumerator.

Parameters

idx

a GgitIndex.

 

Returns

a GgitIndexEntriesResolveUndo.

[transfer full]

Types and Values

GgitIndex

typedef struct _GgitIndex GgitIndex;

Represents an index object.

Property Details

The “file” property

  “file”                     GFile *

File.

Flags: Read / Write / Construct Only