Make it possible to unset values in update-repo

The underlying setters interpret NULL as 'unset this key', but
we never pass NULL. Since empty strings are not useful values
for title or default-branch or redirect-url, just interpret
an explicit empty value as 'unset this key'. E.g. to unset
the redirect url, use

flatpak build-update-repo --redirect-url= ~/my-repo/
tingping/wmclass
Matthias Clasen 2017-05-09 22:05:20 -04:00 committed by Alexander Larsson
parent 0ea9d93001
commit c30e00eef2
1 changed files with 3 additions and 3 deletions

View File

@ -424,15 +424,15 @@ flatpak_builtin_build_update_repo (int argc, char **argv,
}
if (opt_title &&
!flatpak_repo_set_title (repo, opt_title, error))
!flatpak_repo_set_title (repo, opt_title[0] ? opt_title : NULL, error))
return FALSE;
if (opt_redirect_url &&
!flatpak_repo_set_redirect_url (repo, opt_redirect_url, error))
!flatpak_repo_set_redirect_url (repo, opt_redirect_url[0] ? opt_redirect_url : NULL, error))
return FALSE;
if (opt_default_branch &&
!flatpak_repo_set_default_branch (repo, opt_default_branch, error))
!flatpak_repo_set_default_branch (repo, opt_default_branch[0] ? opt_default_branch : NULL, error))
return FALSE;
if (opt_gpg_import)