From 7d286a6dce2ca52879a9953d8e061be1c730b29e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 5 Jul 2017 15:43:55 +0100 Subject: [PATCH] common/dir: Move progress reporting setup higher in flatpak_dir_pull() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- common/flatpak-dir.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 45c938d12..640d28671 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -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 */