main: Treat default osname more consistently

The libostree already treats passing NULL for osname as "booted
osname, if any".  We should do the same inside the tools.  The upgrade
builtin had this logic duplicated there; we should be able to safely
remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=710970
This commit is contained in:
Colin Walters committed 2013-10-28 09:15:32 -04:00
1 parent 7ecfbff26e
commit affccb343a
2 files changed
+3 -2

No files matched your search

-2
View File
@@ -70,8 +70,6 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
if (!ot_admin_require_booted_deployment_or_osname (sysroot, opt_osname,
cancellable, error))
goto out;
if (!opt_osname)
opt_osname = (char*)ostree_deployment_get_osname (ostree_sysroot_get_booted_deployment (sysroot));
merge_deployment = ostree_sysroot_get_merge_deployment (sysroot, opt_osname);
if (merge_deployment == NULL)
{
+3
View File
@@ -67,6 +67,9 @@ ot_admin_complete_deploy_one (OstreeSysroot *sysroot,
deployments = ostree_sysroot_get_deployments (sysroot);
booted_deployment = ostree_sysroot_get_booted_deployment (sysroot);
if (osname == NULL && booted_deployment)
osname = ostree_deployment_get_osname (booted_deployment);
g_ptr_array_add (new_deployments, g_object_ref (new_deployment));
for (i = 0; i < deployments->len; i++)