lib: Add a helper to convert struct stat → GFileInfo

It's more natural for a few calling places. Prep for patches to go the other
way, which in turn are prep for adding a commit filter v2 that takes `struct
stat`.

`ot_gfile_type_for_mode()` was only used in this function, so inline it here.

Closes: #974
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-06-29 18:17:28 +00:00
1 parent 1a9a473580
commit d57410a7e6
8 files changed
+58 -72

No files matched your search

+4 -11
View File
@@ -2791,18 +2791,11 @@ ostree_repo_load_file (OstreeRepo *self,
}
if (out_file_info)
{
*out_file_info = _ostree_header_gfile_info_new (stbuf.st_mode, stbuf.st_uid, stbuf.st_gid);
if (S_ISREG (stbuf.st_mode))
{
g_file_info_set_size (*out_file_info, stbuf.st_size);
}
else if (S_ISLNK (stbuf.st_mode))
{
g_file_info_set_size (*out_file_info, 0);
g_file_info_set_symlink_target (*out_file_info, symlink_target);
}
*out_file_info = _ostree_stbuf_to_gfileinfo (&stbuf);
if (S_ISLNK (stbuf.st_mode))
g_file_info_set_symlink_target (*out_file_info, symlink_target);
else
g_assert_not_reached ();
g_assert (S_ISREG (stbuf.st_mode));
}
ot_transfer_out_value (out_xattrs, &ret_xattrs);