mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-09 12:58:38 +03:00
admin-switch: Don't segfault if there's no remote
Switching between local branches should be supported too. Signed-off-by: Anton Gerasimov <anton@advancedtelematic.com> Closes: #683 Approved by: cgwalters
This commit is contained in:
parent
e6a8979e05
commit
b8f4465b50
@ -53,6 +53,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
|
||||
g_autofree char *new_remote = NULL;
|
||||
g_autofree char *new_ref = NULL;
|
||||
g_autofree char *new_refspec = NULL;
|
||||
const char* remote;
|
||||
glnx_unref_object OstreeSysrootUpgrader *upgrader = NULL;
|
||||
glnx_unref_object OstreeAsyncProgress *progress = NULL;
|
||||
gboolean changed;
|
||||
@ -103,9 +104,14 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
|
||||
}
|
||||
|
||||
if (!new_remote)
|
||||
new_refspec = g_strconcat (origin_remote, ":", new_ref, NULL);
|
||||
remote = origin_remote;
|
||||
else
|
||||
new_refspec = g_strconcat (new_remote, ":", new_ref, NULL);
|
||||
remote = new_remote;
|
||||
|
||||
if (remote)
|
||||
new_refspec = g_strconcat (remote, ":", new_ref, NULL);
|
||||
else
|
||||
new_refspec = g_strdup (new_ref);
|
||||
|
||||
if (strcmp (origin_refspec, new_refspec) == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user