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`

  Type: `GFile`

  A `GFile`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`id`

  Type: `GgitOId`

  A `GgitOId`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GgitIndexEntry`

A `GgitIndexEntry` or `NULL` when an error occurred.

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