[ostree] core: Error out cleanly if user attempts to commit an empty tree
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Error out cleanly if user attempts to commit an empty tree
- Date: Thu, 5 Jan 2012 23:28:01 +0000 (UTC)
commit 5c3614d6448439abcfc12c79517b321117d76808
Author: Colin Walters <walters verbum org>
Date: Thu Jan 5 18:27:21 2012 -0500
core: Error out cleanly if user attempts to commit an empty tree
src/ostree/ot-builtin-commit.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c
index 329c82a..e414a2c 100644
--- a/src/ostree/ot-builtin-commit.c
+++ b/src/ostree/ot-builtin-commit.c
@@ -264,8 +264,17 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
if (!skip_commit)
{
+ const char *root_metadata = ostree_mutable_tree_get_metadata_checksum (mtree);
+
+ if (!root_metadata)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Can't commit an empty tree");
+ goto out;
+ }
+
if (!ostree_repo_stage_commit (repo, branch, parent, subject, body, metadata,
- contents_checksum, ostree_mutable_tree_get_metadata_checksum (mtree),
+ contents_checksum, root_metadata,
&commit_checksum, cancellable, error))
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]