Do "bare" repositories by default

Mixing the repository and checkouts is discouraged.
This commit is contained in:
Colin Walters 2011-10-19 17:45:00 -04:00
parent 648f3ac717
commit 961b1c80db
5 changed files with 9 additions and 49 deletions

View File

@ -37,7 +37,6 @@ libostree_la_SOURCES = src/libostree/ostree.h \
src/libostree/ostree-core.h \ src/libostree/ostree-core.h \
src/libostree/ostree-repo.c \ src/libostree/ostree-repo.c \
src/libostree/ostree-repo.h \ src/libostree/ostree-repo.h \
src/libostree/ostree-types.h \
$(NULL) $(NULL)
libostree_la_CFLAGS = -I$(srcdir)/src/libostree -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) libostree_la_CFLAGS = -I$(srcdir)/src/libostree -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS)
libostree_la_LIBADD = libotutil.la $(GIO_UNIX_LIBS) libostree_la_LIBADD = libotutil.la $(GIO_UNIX_LIBS)

View File

@ -133,8 +133,9 @@ ostree_repo_constructor (GType gtype,
g_assert (priv->path != NULL); g_assert (priv->path != NULL);
priv->repo_file = ot_util_new_file_for_path (priv->path); priv->repo_file = ot_util_new_file_for_path (priv->path);
priv->head_ref_path = g_build_filename (priv->path, OSTREE_REPO_DIR, "HEAD", NULL);
priv->objects_path = g_build_filename (priv->path, OSTREE_REPO_DIR, "objects", NULL); priv->head_ref_path = g_build_filename (priv->path, "HEAD", NULL);
priv->objects_path = g_build_filename (priv->path, "objects", NULL);
return object; return object;
} }

View File

@ -1,33 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#ifndef __OSTREE_TYPES_H__
#define __OSTREE_TYPES_H__
#include <gio/gio.h>
G_BEGIN_DECLS
#define OSTREE_REPO_DIR ".ot"
G_END_DECLS
#endif

View File

@ -23,6 +23,5 @@
#include <ostree-core.h> #include <ostree-core.h>
#include <ostree-repo.h> #include <ostree-repo.h>
#include <ostree-types.h>
#endif #endif

View File

@ -37,12 +37,12 @@ ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error)
{ {
GOptionContext *context = NULL; GOptionContext *context = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
char *htdir_path = NULL; char *otdir_path = NULL;
char *objects_path = NULL; char *objects_path = NULL;
GFile *htdir = NULL; GFile *otdir = NULL;
GFile *objects_dir = NULL; GFile *objects_dir = NULL;
context = g_option_context_new ("- Check the repository for consistency"); context = g_option_context_new ("- Initialize a new empty repository");
g_option_context_add_main_entries (context, options, NULL); g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, error)) if (!g_option_context_parse (context, &argc, &argv, error))
@ -51,13 +51,7 @@ ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error)
if (repo_path == NULL) if (repo_path == NULL)
repo_path = "."; repo_path = ".";
htdir_path = g_build_filename (repo_path, OSTREE_REPO_DIR, NULL); objects_path = g_build_filename (repo_path, "objects", NULL);
htdir = ot_util_new_file_for_path (htdir_path);
if (!g_file_make_directory (htdir, NULL, error))
goto out;
objects_path = g_build_filename (htdir_path, "objects", NULL);
objects_dir = g_file_new_for_path (objects_path); objects_dir = g_file_new_for_path (objects_path);
if (!g_file_make_directory (objects_dir, NULL, error)) if (!g_file_make_directory (objects_dir, NULL, error))
goto out; goto out;
@ -66,7 +60,7 @@ ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error)
out: out:
if (context) if (context)
g_option_context_free (context); g_option_context_free (context);
g_free (htdir_path); g_free (otdir_path);
g_clear_object (&htdir); g_clear_object (&otdir);
return ret; return ret;
} }