[libgit2-glib] Allow NULL for path in create_index_entry_for_path
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Allow NULL for path in create_index_entry_for_path
- Date: Sat, 29 Jun 2013 18:05:36 +0000 (UTC)
commit 068b77a7b3cc3ca122df23849fef8bf1b31d450b
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Jun 29 19:59:03 2013 +0200
Allow NULL for path in create_index_entry_for_path
libgit2-glib/ggit-repository.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 33fecf9..09c9d5e 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -2247,17 +2247,23 @@ ggit_repository_create_index_entry_for_path (GgitRepository *repository,
GgitIndexEntry *ret;
g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), NULL);
- g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- if (!g_path_is_absolute (path))
+ if (path)
{
- f = g_file_resolve_relative_path (repository->priv->workdir,
- path);
+ if (!g_path_is_absolute (path))
+ {
+ f = g_file_resolve_relative_path (repository->priv->workdir,
+ path);
+ }
+ else
+ {
+ f = g_file_new_for_path (path);
+ }
}
else
{
- f = g_file_new_for_path (path);
+ f = NULL;
}
ret = ggit_repository_create_index_entry_for_file (repository,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]