Ggit.IndexEntries.get_by_path

### Method

# Ggit IndexEntriesget_by_path

#### Declaration [src]

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

#### Description [src]

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

`file`

  Type: `GFile`

  The path to search.

  The data is owned by the caller of the function.

`stage`

  Type: `gint`

  Stage to search.

#### Return value

Type: `GgitIndexEntry`

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

The caller of the method takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.