### Method

# Ggit Index read

#### Declaration [src]

    gboolean
    ggit_index_read (
      GgitIndex* idx,
      gboolean force,
      GError** error
    )

#### Description [src]

Update the contents of an existing index object in memory by reading from the hard disk.

If `force` is true, this performs a “hard” read that discards in-memory changes and always reloads the on-disk index data. If there is no on-disk version, the index will be cleared.

If `force` is false, this does a “soft” read that reloads the index data from disk only if it has changed since the last time it was loaded. Purely in-memory index data will be untouched. Be aware: if there are changes on disk, unwritten in-memory changes are discarded.

#### Parameters

`force`

  Type: `gboolean`

  Force read even if there are in-memory changes.

`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: `gboolean`

`TRUE` if the index could be read from the file associated with the index, `FALSE` otherwise.