core: Add standard::size to info we get from archives
This makes "ostree ls" show the file size.
This commit is contained in:
parent
47e94305a1
commit
39fe050f04
|
|
@ -816,6 +816,8 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GFileInfo *ret_info = NULL;
|
GFileInfo *ret_info = NULL;
|
||||||
|
GFile *archive_data_path = NULL;
|
||||||
|
GFileInfo *archive_data_info = NULL;
|
||||||
GVariant *archive_metadata = NULL;
|
GVariant *archive_metadata = NULL;
|
||||||
GVariant *files_variant = NULL;
|
GVariant *files_variant = NULL;
|
||||||
GVariant *dirs_variant = NULL;
|
GVariant *dirs_variant = NULL;
|
||||||
|
|
@ -850,6 +852,20 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
|
||||||
goto out;
|
goto out;
|
||||||
if (!ostree_parse_archived_file_meta (archive_metadata, &ret_info, NULL, error))
|
if (!ostree_parse_archived_file_meta (archive_metadata, &ret_info, NULL, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
archive_data_path = ostree_repo_get_object_path (self->repo, checksum,
|
||||||
|
OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT);
|
||||||
|
archive_data_info = g_file_query_info (archive_data_path,
|
||||||
|
OSTREE_GIO_FAST_QUERYINFO,
|
||||||
|
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||||
|
cancellable,
|
||||||
|
error);
|
||||||
|
if (!archive_data_info)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
g_file_info_set_attribute_uint64 (ret_info, "standard::size",
|
||||||
|
g_file_info_get_attribute_uint64 (archive_data_info,
|
||||||
|
"standard::size"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -902,6 +918,8 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
|
||||||
out:
|
out:
|
||||||
g_clear_object (&ret_info);
|
g_clear_object (&ret_info);
|
||||||
g_clear_object (&local_child);
|
g_clear_object (&local_child);
|
||||||
|
g_clear_object (&archive_data_path);
|
||||||
|
g_clear_object (&archive_data_info);
|
||||||
if (matcher)
|
if (matcher)
|
||||||
g_file_attribute_matcher_unref (matcher);
|
g_file_attribute_matcher_unref (matcher);
|
||||||
ot_clear_gvariant (&archive_metadata);
|
ot_clear_gvariant (&archive_metadata);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ G_BEGIN_DECLS
|
||||||
* readlink(). Other things require opening the file, or also
|
* readlink(). Other things require opening the file, or also
|
||||||
* stat()ing the parent directory.
|
* stat()ing the parent directory.
|
||||||
*/
|
*/
|
||||||
#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::is-symlink,standard::symlink-target,standard::is-hidden," \
|
#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::size,standard::is-symlink,standard::symlink-target,standard::is-hidden," \
|
||||||
"unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
|
"unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
|
||||||
|
|
||||||
GFileType ot_gfile_type_for_mode (guint32 mode);
|
GFileType ot_gfile_type_for_mode (guint32 mode);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue