GgitIndexEntry: libgit2-glib Reference Manual

## GgitIndexEntry GgitIndexEntry |

## Functions

GgitIndexEntries * | ggit_index_entries_ref ()
void | ggit_index_entries_unref ()
GgitIndexEntry * | ggit_index_entries_get_by_index ()
GgitIndexEntry * | ggit_index_entries_get_by_path ()
guint | ggit_index_entries_size ()
GgitIndexEntry * | ggit_index_entry_ref ()
void | ggit_index_entry_unref ()
guint | ggit_index_entry_get_dev ()
void | ggit_index_entry_set_dev ()
guint | ggit_index_entry_get_ino ()
void | ggit_index_entry_set_ino ()
guint | ggit_index_entry_get_mode ()
void | ggit_index_entry_set_mode ()
guint | ggit_index_entry_get_uid ()
void | ggit_index_entry_set_uid ()
guint | ggit_index_entry_get_gid ()
void | ggit_index_entry_set_gid ()
goffset | ggit_index_entry_get_file_size ()
void | ggit_index_entry_set_file_size ()
GgitOId * | ggit_index_entry_get_id ()
void | ggit_index_entry_set_id ()
guint | ggit_index_entry_get_flags ()
void | ggit_index_entry_set_flags ()
guint | ggit_index_entry_get_flags_extended ()
void | ggit_index_entry_set_flags_extended ()
const gchar * | ggit_index_entry_get_path ()
void | ggit_index_entry_set_path ()
gboolean | ggit_index_entry_stat ()

## Types and Values

| GgitIndexEntries
| GgitIndexEntry

## Object Hierarchy

        GBoxed
        ├── GgitIndexEntries
        ╰── GgitIndexEntry

## Description

## Functions

### ggit_index_entries_ref ()

    GgitIndexEntries *
    ggit_index_entries_ref (GgitIndexEntries *entries);

Atomically increments the reference count of `entries` by one. This function is MT-safe and may be called from any thread.

#### Parameters

entries | a GgitIndexEntries. |

#### Returns

a GgitIndexEntries.

[transfer none]

### ggit_index_entries_unref ()

    void
    ggit_index_entries_unref (GgitIndexEntries *entries);

Atomically decrements the reference count of `entries` by one. If the reference count drops to 0, `entries` is freed.

#### Parameters

entries | a GgitIndexEntries. |

### ggit_index_entries_get_by_index ()

    GgitIndexEntry *
    ggit_index_entries_get_by_index (GgitIndexEntries *entries,
                                     gsize idx);

Get a GgitIndexEntry by index. Note that the returned GgitIndexEntry is _only_ valid as long as:

1) The associated index has been closed 2) The entry has not been removed (see `ggit_index_remove()`) 3) The index has not been refreshed (see `ggit_index_read()`)

Changes to the GgitIndexEntry will be reflected in the index once written back to disk using `ggit_index_write()`.

#### Parameters

entries | a GgitIndexEntries. |
idx | the index of the entry. |

#### Returns

a GgitIndexEntry or `NULL` if out of bounds.

[transfer full]

### ggit_index_entries_get_by_path ()

    GgitIndexEntry *
    ggit_index_entries_get_by_path (GgitIndexEntries *entries,
                                    GFile *file,
                                    gint stage);

Get a GgitIndexEntry by index. Note that the returned GgitIndexEntry is _only_ valid as long as:

1) The associated index has not been closed 2) The entry has not been removed (see `ggit_index_remove()`) 3) The index has not been refreshed (see `ggit_index_read()`)

Changes to the GgitIndexEntry will be reflected in the index once written back to disk using `ggit_index_write()`.

`stage` indicates the stage to search the file for. Stages are used in the index when merge conflicts occur, such that multiple versions of the same file can be represented in the index. Stage 0 is associated with the working tree, while stages 1 to 3 are associated with the various versions of the file in a merge conflict. The special value -1 can be used to match the first file encountered in any stage.

#### Parameters

entries | a GgitIndexEntries. |
file | the path to search. |
stage | stage to search. |

#### Returns

a GgitIndexEntry or `NULL` if it was not found.

[transfer full]

### ggit_index_entries_size ()

    guint
    ggit_index_entries_size (GgitIndexEntries *entries);

Get the number of GgitIndexEntry entries.

#### Parameters

entries | a GgitIndexEntries. |

#### Returns

the number of entries.

### ggit_index_entry_ref ()

    GgitIndexEntry *
    ggit_index_entry_ref (GgitIndexEntry *entry);

Atomically increments the reference count of `entry` by one. This function is MT-safe and may be called from any thread.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

a GgitIndexEntry.

[transfer none]

### ggit_index_entry_unref ()

    void
    ggit_index_entry_unref (GgitIndexEntry *entry);

Atomically decrements the reference count of `entry` by one. If the reference count drops to 0, `entry` is freed.

#### Parameters

entry | a GgitIndexEntry. |

### ggit_index_entry_get_dev ()

    guint
    ggit_index_entry_get_dev (GgitIndexEntry *entry);

Get the dev of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the dev.

### ggit_index_entry_set_dev ()

    void
    ggit_index_entry_set_dev (GgitIndexEntry *entry,
                              guint dev);

Set the dev of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
dev | the dev. |

### ggit_index_entry_get_ino ()

    guint
    ggit_index_entry_get_ino (GgitIndexEntry *entry);

Get the ino of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the ino.

### ggit_index_entry_set_ino ()

    void
    ggit_index_entry_set_ino (GgitIndexEntry *entry,
                              guint ino);

Set the ino of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
ino | the ino. |

### ggit_index_entry_get_mode ()

    guint
    ggit_index_entry_get_mode (GgitIndexEntry *entry);

Get the mode of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the mode.

### ggit_index_entry_set_mode ()

    void
    ggit_index_entry_set_mode (GgitIndexEntry *entry,
                               guint mode);

Set the mode of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
mode | the mode. |

### ggit_index_entry_get_uid ()

    guint
    ggit_index_entry_get_uid (GgitIndexEntry *entry);

Get the uid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the uid.

### ggit_index_entry_set_uid ()

    void
    ggit_index_entry_set_uid (GgitIndexEntry *entry,
                              guint uid);

Set the uid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
uid | the uid. |

### ggit_index_entry_get_gid ()

    guint
    ggit_index_entry_get_gid (GgitIndexEntry *entry);

Get the gid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the gid.

### ggit_index_entry_set_gid ()

    void
    ggit_index_entry_set_gid (GgitIndexEntry *entry,
                              guint gid);

Set the gid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
gid | the gid. |

### ggit_index_entry_get_file_size ()

    goffset
    ggit_index_entry_get_file_size (GgitIndexEntry *entry);

Get the file size of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the file size.

### ggit_index_entry_set_file_size ()

    void
    ggit_index_entry_set_file_size (GgitIndexEntry *entry,
                                    goffset file_size);

Set the file size of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
file_size | the file size. |

### ggit_index_entry_get_id ()

    GgitOId *
    ggit_index_entry_get_id (GgitIndexEntry *entry);

Get the oid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the oid.

### ggit_index_entry_set_id ()

    void
    ggit_index_entry_set_id (GgitIndexEntry *entry,
                             GgitOId *id);

Set the oid of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
id | the oid. | [allow-none]

### ggit_index_entry_get_flags ()

    guint
    ggit_index_entry_get_flags (GgitIndexEntry *entry);

Get the flags of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the flags.

### ggit_index_entry_set_flags ()

    void
    ggit_index_entry_set_flags (GgitIndexEntry *entry,
                                guint flags);

Set the flags of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
flags | the flags. |

### ggit_index_entry_get_flags_extended ()

    guint
    ggit_index_entry_get_flags_extended (GgitIndexEntry *entry);

Get the extended flags of the index entry.

#### Parameters

entry | a GgitIndexEntry. |

#### Returns

the extended flags.

### ggit_index_entry_set_flags_extended ()

    void
    ggit_index_entry_set_flags_extended (GgitIndexEntry *entry,
                                         guint flags_extended);

Set the extended flags of the index entry.

#### Parameters

entry | a GgitIndexEntry. |
flags_extended | the extended flags. |

### ggit_index_entry_get_path ()

    const gchar *
    ggit_index_entry_get_path (GgitIndexEntry *entry);

### ggit_index_entry_set_path ()

    void
    ggit_index_entry_set_path (GgitIndexEntry *entry,
                               const gchar *path);

Set the path of the index entry. The path should be relative to the working directory.

#### Parameters

entry | a GgitIndexEntry. |
path | the path. | [allow-none]

### ggit_index_entry_stat ()

    gboolean
    ggit_index_entry_stat (GgitIndexEntry *entry,
                           GFile *file,
                           GError **error);

Fill the entry fields from statting `file` .

#### Parameters

entry | a GgitIndexEntry. |
file | the file to stat. |
error | a GError for error reporting, or `NULL`. |

#### Returns

`TRUE` if the entry was filled from statting `file` successfully, `FALSE` otherwise.

## Types and Values

### GgitIndexEntries

    typedef struct _GgitIndexEntries GgitIndexEntries;

Represents the entries in an index object.

### GgitIndexEntry

    typedef struct _GgitIndexEntry GgitIndexEntry;

Represents an index entry object.