[libgit2-glib] Do not fail index entry creation when stat fails



commit 53ea340487afcc3479d5545a17e41a0f5a7025b2
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Jun 29 19:18:26 2013 +0200

    Do not fail index entry creation when stat fails

 libgit2-glib/ggit-repository.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index bc29255..33fecf9 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -2166,9 +2166,8 @@ ggit_repository_create_tree_builder_from_tree (GgitRepository  *repository,
  * 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, must exist and be readable (otherwise %NULL is
- * returned and @error is set accordingly). The file related
- * fields of the returned entry are also queried from this file.
+ * 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)
@@ -2209,10 +2208,9 @@ ggit_repository_create_index_entry_for_file (GgitRepository  *repository,
        ret = _ggit_index_entry_new (path, id);
        g_free (path);
 
-       if (file && !ggit_index_entry_stat (ret, file, error))
+       if (file)
        {
-               ggit_index_entry_unref (ret);
-               return NULL;
+               ggit_index_entry_stat (ret, file, NULL);
        }
 
        return ret;
@@ -2227,11 +2225,10 @@ ggit_repository_create_index_entry_for_file (GgitRepository  *repository,
  *
  * Create a new index entry. When @path is not %NULL, the path of the returned
  * entry (#ggit_index_entry_get_path) is set @path. The specified path can be
- * either absolute or relative, but must exist and be readable (otherwise %NULL
- * is returned and @error is set accordingly). In the case of
+ * 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.
+ * 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]