[libgit2-glib] Added force parameter to ggit_index_read
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Added force parameter to ggit_index_read
- Date: Fri, 22 Nov 2013 18:15:05 +0000 (UTC)
commit 1d681f9ec7138563fa152b36f6e1aa489b704af0
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Fri Nov 22 19:14:33 2013 +0100
Added force parameter to ggit_index_read
libgit2-glib/ggit-index.c | 13 ++++++++++++-
libgit2-glib/ggit-index.h | 1 +
2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/libgit2-glib/ggit-index.c b/libgit2-glib/ggit-index.c
index 3636709..a53b6f0 100644
--- a/libgit2-glib/ggit-index.c
+++ b/libgit2-glib/ggit-index.c
@@ -236,17 +236,28 @@ ggit_index_open (GFile *file,
/**
* ggit_index_read:
* @idx: a #GgitIndex.
+ * @force: force read even if there are in-memory changes.
* @error: a #GError for error reporting, or %NULL.
*
* 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.
+ *
* Returns: %TRUE if the index could be read from the file associated with the
* index, %FALSE otherwise.
*
**/
gboolean
ggit_index_read (GgitIndex *idx,
+ gboolean force,
GError **error)
{
gint ret;
@@ -254,7 +265,7 @@ ggit_index_read (GgitIndex *idx,
g_return_val_if_fail (GGIT_IS_INDEX (idx), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- ret = git_index_read (_ggit_native_get (idx));
+ ret = git_index_read (_ggit_native_get (idx), (int)force);
if (ret != GIT_OK)
{
diff --git a/libgit2-glib/ggit-index.h b/libgit2-glib/ggit-index.h
index 8ff3541..d69faa0 100644
--- a/libgit2-glib/ggit-index.h
+++ b/libgit2-glib/ggit-index.h
@@ -70,6 +70,7 @@ GgitIndex *ggit_index_open (GFile *file,
GError **error);
gboolean ggit_index_read (GgitIndex *idx,
+ gboolean force,
GError **error);
gboolean ggit_index_write (GgitIndex *idx,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]