Skip to content

Commit dbd83bc

Browse files
committed
kargs: Minor code reordering
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]>
1 parent 53e1f82 commit dbd83bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/src/kargs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,19 @@ pub(crate) fn get_kargs(
7474
let existing_kargs: Vec<String> = get_kargs_in_root(root, sys_arch)?;
7575

7676
// Get the kargs in kargs.d of the pending image
77-
let mut remote_kargs: Vec<String> = vec![];
7877
let (fetched_tree, _) = repo.read_commit(fetched.ostree_commit.as_str(), cancellable)?;
7978
let fetched_tree = fetched_tree.resolve_relative_path("/usr/lib/bootc/kargs.d");
8079
let fetched_tree = fetched_tree
8180
.downcast::<ostree::RepoFile>()
8281
.expect("downcast");
82+
// A special case: if there's no kargs.d directory in the pending (fetched) image,
83+
// then we can just use the combined current kargs + kargs from booted
8384
if !fetched_tree.query_exists(cancellable) {
84-
// if the kargs.d directory does not exist in the fetched image, return the existing kargs
8585
kargs.extend(existing_kargs);
8686
return Ok(kargs);
8787
}
88+
89+
let mut remote_kargs: Vec<String> = vec![];
8890
let queryattrs = "standard::name,standard::type";
8991
let queryflags = gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS;
9092
let fetched_iter = fetched_tree.enumerate_children(queryattrs, queryflags, cancellable)?;

0 commit comments

Comments
 (0)