[ostree] core: Some tweaks to ls output
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Some tweaks to ls output
- Date: Mon, 28 Nov 2011 18:07:36 +0000 (UTC)
commit b296dc4efc90957d1ff468ae4621440cb96835e2
Author: Colin Walters <walters verbum org>
Date: Mon Nov 28 10:17:49 2011 -0500
core: Some tweaks to ls output
src/libostree/ostree-repo-file.c | 5 ++++-
src/ostree/ot-builtin-ls.c | 19 ++++++++++++++-----
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index fd9b30f..11887f0 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -194,8 +194,10 @@ do_resolve_commit (OstreeRepoFile *self,
root_metadata = NULL;
self->tree_contents = root_contents;
root_contents = NULL;
+ self->tree_contents_checksum = g_strdup (tree_contents_checksum);
self->tree_metadata_checksum = g_strdup (tree_meta_checksum);
+ ret = TRUE;
out:
ot_clear_gvariant (&commit);
ot_clear_gvariant (&root_metadata);
@@ -253,6 +255,8 @@ do_resolve_nonroot (OstreeRepoFile *self,
tree_contents = NULL;
self->tree_metadata = tree_metadata;
tree_metadata = NULL;
+ self->tree_contents_checksum = g_strdup (content_checksum);
+ self->tree_metadata_checksum = g_strdup (metadata_checksum);
}
else
self->index = i;
@@ -377,7 +381,6 @@ _ostree_repo_file_tree_set_content_checksum (OstreeRepoFile *self,
const char *
_ostree_repo_file_tree_get_content_checksum (OstreeRepoFile *self)
{
- g_assert (self->parent == NULL);
return self->tree_contents_checksum;
}
diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c
index c3d92cd..7784b3a 100644
--- a/src/ostree/ot-builtin-ls.c
+++ b/src/ostree/ot-builtin-ls.c
@@ -45,12 +45,17 @@ print_one_file (GFile *f,
GString *buf = NULL;
char type_c;
guint32 mode;
+ guint32 type;
+
+ if (!_ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
+ g_assert_not_reached ();
buf = g_string_new ("");
type_c = '?';
mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
- switch (g_file_info_get_file_type (file_info))
+ type = g_file_info_get_file_type (file_info);
+ switch (type)
{
case G_FILE_TYPE_REGULAR:
type_c = '-';
@@ -74,14 +79,18 @@ print_one_file (GFile *f,
break;
}
g_string_append_c (buf, type_c);
- g_string_append_printf (buf, "0%03o %u %u %" G_GUINT64_FORMAT " ",
+ g_string_append_printf (buf, "0%04o %u %u %6" G_GUINT64_FORMAT " ",
mode & ~S_IFMT,
g_file_info_get_attribute_uint32 (file_info, "unix::uid"),
g_file_info_get_attribute_uint32 (file_info, "unix::gid"),
g_file_info_get_attribute_uint64 (file_info, "standard::size"));
if (checksum)
- g_string_append_printf (buf, "%s ", _ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
+ {
+ if (type == G_FILE_TYPE_DIRECTORY)
+ g_string_append_printf (buf, "%s ", _ostree_repo_file_tree_get_content_checksum ((OstreeRepoFile*)f));
+ g_string_append_printf (buf, "%s ", _ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
+ }
if (xattrs)
{
@@ -94,14 +103,14 @@ print_one_file (GFile *f,
formatted = g_variant_print (xattrs, TRUE);
g_string_append (buf, "{ ");
g_string_append (buf, formatted);
- g_string_append (buf, "} ");
+ g_string_append (buf, " } ");
g_free (formatted);
g_variant_unref (xattrs);
}
g_string_append (buf, ot_gfile_get_path_cached (f));
- if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK)
+ if (type == G_FILE_TYPE_SYMBOLIC_LINK)
g_string_append_printf (buf, " -> %s", g_file_info_get_attribute_byte_string (file_info, "standard::symlink-target"));
g_print ("%s\n", buf->str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]