mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-11-22 07:15:22 +00:00
Prune orphaned rename files from manifest
When renamed-to files are deleted or are renamed again, the original renamed-from file is orphaned as it has no renamed-to peer. Prune these from the manifests by checking if the rename_peer field is NULL. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
@@ -1045,6 +1045,14 @@ int prune_manifest(struct manifest *manifest)
|
||||
next = g_list_next(list);
|
||||
file = list->data;
|
||||
|
||||
/* if the file is marked as deleted and renamed it is a renamed_from
|
||||
* file. If the rename_peer field is still NULL then it has been
|
||||
* orphaned. Prune these files */
|
||||
if (file->is_deleted && file->is_rename && !file->rename_peer) {
|
||||
manifest->files = g_list_delete_link(manifest->files, list);
|
||||
manifest->count--;
|
||||
}
|
||||
|
||||
if (OS_IS_STATELESS && (!file->is_deleted) && (file->is_config)) {
|
||||
// toward being a stateless OS
|
||||
LOG(file, "Skipping config file in manifest write", "component %s", manifest->component);
|
||||
|
||||
Reference in New Issue
Block a user