Skip to content

Commit

Permalink
kargs: Minor code reordering
Browse files Browse the repository at this point in the history
No functional changes, but it's clearer to have the `remote_kargs`
definition below where we do the short-circuit.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jun 27, 2024
1 parent 53e1f82 commit 128c3d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/kargs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,19 @@ pub(crate) fn get_kargs(
let existing_kargs: Vec<String> = get_kargs_in_root(root, sys_arch)?;

// Get the kargs in kargs.d of the pending image
let mut remote_kargs: Vec<String> = vec![];
let (fetched_tree, _) = repo.read_commit(fetched.ostree_commit.as_str(), cancellable)?;
let fetched_tree = fetched_tree.resolve_relative_path("/usr/lib/bootc/kargs.d");
let fetched_tree = fetched_tree
.downcast::<ostree::RepoFile>()
.expect("downcast");
// A special case: if there's no kargs.d directory in the pending (fetched) image,
// then we can just use the combined current kargs +
if !fetched_tree.query_exists(cancellable) {
// if the kargs.d directory does not exist in the fetched image, return the existing kargs
kargs.extend(existing_kargs);
return Ok(kargs);
}

let mut remote_kargs: Vec<String> = vec![];
let queryattrs = "standard::name,standard::type";
let queryflags = gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS;
let fetched_iter = fetched_tree.enumerate_children(queryattrs, queryflags, cancellable)?;
Expand Down

0 comments on commit 128c3d0

Please sign in to comment.