### Method

# Ggit Repository create_index_entry_for_path

#### Declaration [src]

    GgitIndexEntry*
    ggit_repository_create_index_entry_for_path (
      GgitRepository* repository,
      const gchar* path,
      GgitOId* id,
      GError** error
    )

#### Description [src]

Create a new index entry. When `path` is not `NULL`, the path of the returned entry (#ggit_index_entry_get_path) is set to `path`. The specified path can be either absolute or relative. In the case of an absolute path, the path must reside within the working directory of `repository`. The file related fields of the returned entry are also queried from this path (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

`path`

  Type: `const gchar*`

  A path.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

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