common/dir: Move progress reporting setup higher in flatpak_dir_pull()

This will slightly simplify some later refactoring. It makes no real
difference to the function’s behaviour at the moment.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
tingping/wmclass
Philip Withnall 2017-07-05 15:43:55 +01:00
parent 4ffe706cd9
commit 7d286a6dce
1 changed files with 11 additions and 10 deletions

View File

@ -2546,6 +2546,17 @@ flatpak_dir_pull (FlatpakDir *self,
if (*url == 0)
return TRUE; /* Empty url, silently disables updates */
/* Set up progress reporting. */
if (progress == NULL)
{
glnx_console_lock (&console);
if (console.is_tty)
{
console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
progress = console_progress;
}
}
/* We get the rev ahead of time so that we know it for looking up e.g. extra-data
and to make sure we're atomically using a single rev if we happen to do multiple
pulls (e.g. with subpaths) */
@ -2561,16 +2572,6 @@ flatpak_dir_pull (FlatpakDir *self,
if (repo == NULL)
repo = self->repo;
if (progress == NULL)
{
glnx_console_lock (&console);
if (console.is_tty)
{
console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
progress = console_progress;
}
}
/* Past this we must use goto out, so we clean up console and
abort the transaction on error */