core: Deduplicate code converting struct stat -> GFileInfo
We were doing the same thing in a number of places, make a helper function.
This commit is contained in:
1 parent
880328ba03
commit
c4efbf6718
4 files changed
+34
-29
No files matched your search
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "ostree-core-private.h"
|
||||
#include "ostree-repo-private.h"
|
||||
#include "ostree-mutable-tree.h"
|
||||
|
||||
@@ -48,19 +49,15 @@ file_info_from_archive_entry_and_modifier (OstreeRepo *repo,
|
||||
struct archive_entry *entry,
|
||||
OstreeRepoCommitModifier *modifier)
|
||||
{
|
||||
gs_unref_object GFileInfo *info = g_file_info_new ();
|
||||
gs_unref_object GFileInfo *info = NULL;
|
||||
GFileInfo *modified_info = NULL;
|
||||
const struct stat *st;
|
||||
guint32 file_type;
|
||||
|
||||
st = archive_entry_stat (entry);
|
||||
|
||||
info = _ostree_header_gfile_info_new (st->st_mode, st->st_uid, st->st_gid);
|
||||
file_type = ot_gfile_type_for_mode (st->st_mode);
|
||||
g_file_info_set_attribute_boolean (info, "standard::is-symlink", S_ISLNK (st->st_mode));
|
||||
g_file_info_set_attribute_uint32 (info, "standard::type", file_type);
|
||||
g_file_info_set_attribute_uint32 (info, "unix::uid", st->st_uid);
|
||||
g_file_info_set_attribute_uint32 (info, "unix::gid", st->st_gid);
|
||||
g_file_info_set_attribute_uint32 (info, "unix::mode", st->st_mode);
|
||||
|
||||
if (file_type == G_FILE_TYPE_REGULAR)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user