summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-init.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-12-22 11:04:08 -0500
committerColin Walters <walters@verbum.org>2011-12-22 11:04:08 -0500
commitd25f1bf73d3b992a3209bd908faff489d8309443 (patch)
treedc4889d35418145285f39f93aaffc7b3d632550a /src/ostree/ot-builtin-init.c
parent8a499c4a2a9899f42b57d09acbd011ca028d50a4 (diff)
downloadostree-d25f1bf73d3b992a3209bd908faff489d8309443.tar.gz
core: Use GFile for repo constructor API, and a bit more internally
Also, ensure that the repo directory GFile is absolute - this avoids a getcwd() syscall every time we construct a GFile object.
Diffstat (limited to 'src/ostree/ot-builtin-init.c')
-rw-r--r--src/ostree/ot-builtin-init.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/ostree/ot-builtin-init.c b/src/ostree/ot-builtin-init.c
index 96bf67f2..935bae70 100644
--- a/src/ostree/ot-builtin-init.c
+++ b/src/ostree/ot-builtin-init.c
@@ -39,11 +39,10 @@ static GOptionEntry options[] = {
gboolean
-ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **error)
+ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error)
{
GOptionContext *context = NULL;
gboolean ret = FALSE;
- GFile *repodir = NULL;
GFile *child = NULL;
GFile *grandchild = NULL;
GString *config_data = NULL;
@@ -54,9 +53,7 @@ ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **erro
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- repodir = ot_gfile_new_for_path (repo_path);
-
- child = g_file_get_child (repodir, "config");
+ child = g_file_get_child (repo_path, "config");
config_data = g_string_new (DEFAULT_CONFIG_CONTENTS);
g_string_append_printf (config_data, "mode=%s\n", archive ? "archive" : "bare");
@@ -68,17 +65,17 @@ ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **erro
goto out;
g_clear_object (&child);
- child = g_file_get_child (repodir, "objects");
+ child = g_file_get_child (repo_path, "objects");
if (!g_file_make_directory (child, NULL, error))
goto out;
g_clear_object (&child);
- child = g_file_get_child (repodir, "tmp");
+ child = g_file_get_child (repo_path, "tmp");
if (!g_file_make_directory (child, NULL, error))
goto out;
g_clear_object (&child);
- child = g_file_get_child (repodir, "refs");
+ child = g_file_get_child (repo_path, "refs");
if (!g_file_make_directory (child, NULL, error))
goto out;
@@ -94,7 +91,7 @@ ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **erro
g_clear_object (&child);
- child = g_file_get_child (repodir, "tags");
+ child = g_file_get_child (repo_path, "tags");
if (!g_file_make_directory (child, NULL, error))
goto out;
g_clear_object (&child);
@@ -105,7 +102,6 @@ ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **erro
g_option_context_free (context);
if (config_data)
g_string_free (config_data, TRUE);
- g_clear_object (&repodir);
g_clear_object (&child);
g_clear_object (&grandchild);
return ret;