Ggit.Repository.create_index_entry_for_file

### Method

# Ggit Repositorycreate_index_entry_for_file

#### Declaration [src]

    GgitIndexEntry*
    ggit_repository_create_index_entry_for_file (
      GgitRepository* repository,
      GFile* file,
      GgitOId* id,
      GError** error
    )

#### Description [src]

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).

If `id` is not `NULL`, then the id of the returned entry is set to `id` (see #ggit_index_entry_get_id) which could point to a blob (for a file) or a tree (for a directory).

#### Parameters

`file` | `GFile`
| A `GFile`.
| The argument can be `NULL`.
| The data is owned by the caller of the function.
`id` | `GgitOId`
| A `GgitOId`.
| The argument can be `NULL`.
| The data is owned by the caller of the function.
`error` | `GError **`
| The return location for a `GError*`, or `NULL`.

#### Return value

Returns: | `GgitIndexEntry`
| A `GgitIndexEntry` or `NULL` when an error occurred.
| The caller of the method takes ownership of the data, and is responsible for freeing it.
| The return value can be `NULL`.