core: Some tweaks to ls output

This commit is contained in:
Colin Walters 2011-11-28 10:17:49 -05:00
parent 3f0866dc79
commit b296dc4efc
2 changed files with 18 additions and 6 deletions

View File

@ -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;
}

View File

@ -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);