Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Avoid a superfluous prompt to choose the only remote #4382

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/flatpak-builtins-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
if (remote_dir_pairs->len == 0)
return flatpak_fail (error, _("No remote refs found similar to ‘%s’"), argv[1]);

if (!flatpak_resolve_matching_remotes (opt_yes, remote_dir_pairs, argv[1], &chosen_pair, error))
if (!flatpak_resolve_matching_remotes (remote_dir_pairs, argv[1], &chosen_pair, error))
return FALSE;

remote = g_strdup (chosen_pair->remote_name);
Expand Down
9 changes: 6 additions & 3 deletions app/flatpak-builtins-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ flatpak_resolve_matching_installed_refs (gboolean assume_yes,
}

gboolean
flatpak_resolve_matching_remotes (gboolean assume_yes,
GPtrArray *remote_dir_pairs,
flatpak_resolve_matching_remotes (GPtrArray *remote_dir_pairs,
const char *opt_search_ref,
RemoteDirPair **out_pair,
GError **error)
Expand All @@ -563,7 +562,11 @@ flatpak_resolve_matching_remotes (gboolean assume_yes,

g_assert (remote_dir_pairs->len > 0);

if (assume_yes && remote_dir_pairs->len == 1)
/* Here we use the only matching remote even if --assumeyes wasn't specified
* because the user will still be asked to confirm the operation in the next
* step after the dependencies are resolved.
*/
if (remote_dir_pairs->len == 1)
chosen = 1;

if (chosen == 0)
Expand Down
3 changes: 1 addition & 2 deletions app/flatpak-builtins-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ gboolean flatpak_resolve_matching_installed_refs (gboolean assume_yes,
GPtrArray *out_pairs,
GError **error);

gboolean flatpak_resolve_matching_remotes (gboolean assume_yes,
GPtrArray *remote_dir_pairs,
gboolean flatpak_resolve_matching_remotes (GPtrArray *remote_dir_pairs,
const char *opt_search_ref,
RemoteDirPair **out_pair,
GError **error);
Expand Down