From 2f50ad43ccd752ca67cefe1176ef748d1f4f0a44 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 13 Mar 2017 14:15:41 +0100 Subject: [PATCH] build-bundle: Allow specifying a full ref This is useful in some cases. --- app/flatpak-builtins-build-bundle.c | 31 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/app/flatpak-builtins-build-bundle.c b/app/flatpak-builtins-build-bundle.c index e393199b..0147f2ad 100644 --- a/app/flatpak-builtins-build-bundle.c +++ b/app/flatpak-builtins-build-bundle.c @@ -442,22 +442,27 @@ flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, if (!g_file_query_exists (repofile, cancellable)) return flatpak_fail (error, _("'%s' is not a valid repository"), location); - file = g_file_new_for_commandline_arg (filename); - - if (!flatpak_is_valid_name (name, &my_error)) - return flatpak_fail (error, _("'%s' is not a valid name: %s"), name, my_error->message); - - if (!flatpak_is_valid_branch (branch, &my_error)) - return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, &my_error); - - if (opt_runtime) - full_branch = flatpak_build_runtime_ref (name, branch, opt_arch); - else - full_branch = flatpak_build_app_ref (name, branch, opt_arch); - if (!ostree_repo_open (repo, cancellable, error)) return FALSE; + file = g_file_new_for_commandline_arg (filename); + + if (ostree_repo_resolve_rev (repo, name, FALSE, NULL, NULL)) + full_branch = g_strdup (name); + else + { + if (!flatpak_is_valid_name (name, &my_error)) + return flatpak_fail (error, _("'%s' is not a valid name: %s"), name, my_error->message); + + if (!flatpak_is_valid_branch (branch, &my_error)) + return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, &my_error); + + if (opt_runtime) + full_branch = flatpak_build_runtime_ref (name, branch, opt_arch); + else + full_branch = flatpak_build_app_ref (name, branch, opt_arch); + } + if (opt_oci) { if (!build_oci (repo, file, name, full_branch, cancellable, error))