From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id EAA051F4B4 for ; Fri, 25 Sep 2020 12:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbgIYMdu (ORCPT ); Fri, 25 Sep 2020 08:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728333AbgIYMdr (ORCPT ); Fri, 25 Sep 2020 08:33:47 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD080C0613CE for ; Fri, 25 Sep 2020 05:33:46 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e16so3455188wrm.2 for ; Fri, 25 Sep 2020 05:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=ddgOxQAf9A7kFmL2ILUM2HpYvMuwscp0rEU6vEGE8Rg=; b=JkxYn4sJj/JIB+ZCEhsK4MsQd401RndDnSiSx+jbpDJC06yxtcLe0dcO3+xE0uOCs/ wBf7iW/at6Nb9/9DuImYPp91c4RNvt1e2cesKLQER9MiBj4zvHvlhyGstVIKErbCMgq8 BGEUXn9CcQmcwczyqyaS2IhM9YbqJvjQnv1oSLG3vJNrmvOSW2U69xLTHF2/fBfLImrQ SUNZQurYPn08HvWd0hruEFHntvPCTNRdyMA1ZjLOCrqWjLUQ4fw9ckFXKUvlMF0uBfho VNOHldEQgO384r1Qhl8QoUJn/CvhGV3J0OLGIqSbVqkipYf/2bNKvStjoZTnH2/p6QOX 843A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=ddgOxQAf9A7kFmL2ILUM2HpYvMuwscp0rEU6vEGE8Rg=; b=XG0sOZGTglnn6J7TQsYXiKMoWwujFDnDQnv/DlMzWAOIknkXS2rYIr9/AOv3+Qtk0j maUCteDcej417R2BhGpGdwU7vu+6vkSEPgQPME3ZBcPVcf6mgaq+42QdgcL9Yxp6ab66 LnZmUmZVyLU5fkKm0XM71AX2SeNWFXEzmN9zG/MKkYKyIC2A0Xc3utoayghv/TR//xLu diKG1AuH9nOrWApmhe1WmbZQU5G9A/5YHLpJFnPEJBIpwqYQ3kUMBYoUqh6SnMa3QfPt GJsxn6koOncZtuGEPj3DRB5DGJBpRIM7GhdDdY2SWtYjzjQieVNB2gKV+9oEZs9kVOGf wYPg== X-Gm-Message-State: AOAM5305+xN0uXkd4t001kg4yZ2uCx2Di5T9XEkp+uPbChyHcabmZgkJ MY8pyqp9AbgCTq/g8H0qAL46+30WTIY= X-Google-Smtp-Source: ABdhPJwK2P9a3DPcumd5IMSGO6tbuZ9unPPSK0AJlpFUGMRbPkQp9V0AVaDfP/uXAd9qrbAqmNxXKw== X-Received: by 2002:adf:8481:: with SMTP id 1mr4126787wrg.231.1601037225161; Fri, 25 Sep 2020 05:33:45 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c16sm3045899wrx.31.2020.09.25.05.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 05:33:44 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Fri, 25 Sep 2020 12:33:35 +0000 Subject: [PATCH v4 5/8] midx: use start_delayed_progress() Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: sandals@crustytoothpaste.net, steadmon@google.com, jrnieder@gmail.com, peff@peff.net, congdanhqx@gmail.com, phillip.wood123@gmail.com, emilyshaffer@google.com, sluongng@gmail.com, jonathantanmy@google.com, Jonathan Tan , Derrick Stolee , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee Now that the multi-pack-index may be written as part of auto maintenance at the end of a command, reduce the progress output when the operations are quick. Use start_delayed_progress() instead of start_progress(). Update t5319-multi-pack-index.sh to use GIT_PROGRESS_DELAY=0 now that the progress indicators are conditional. Signed-off-by: Derrick Stolee --- midx.c | 10 +++++----- t/t5319-multi-pack-index.sh | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/midx.c b/midx.c index ef499cf504..aa37d5da86 100644 --- a/midx.c +++ b/midx.c @@ -832,7 +832,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index * packs.pack_paths_checked = 0; if (flags & MIDX_PROGRESS) - packs.progress = start_progress(_("Adding packfiles to multi-pack-index"), 0); + packs.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0); else packs.progress = NULL; @@ -969,7 +969,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index * } if (flags & MIDX_PROGRESS) - progress = start_progress(_("Writing chunks to multi-pack-index"), + progress = start_delayed_progress(_("Writing chunks to multi-pack-index"), num_chunks); for (i = 0; i < num_chunks; i++) { if (written != chunk_offsets[i]) @@ -1104,7 +1104,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag return 0; if (flags & MIDX_PROGRESS) - progress = start_progress(_("Looking for referenced packfiles"), + progress = start_delayed_progress(_("Looking for referenced packfiles"), m->num_packs); for (i = 0; i < m->num_packs; i++) { if (prepare_midx_pack(r, m, i)) @@ -1225,7 +1225,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla count = xcalloc(m->num_packs, sizeof(uint32_t)); if (flags & MIDX_PROGRESS) - progress = start_progress(_("Counting referenced objects"), + progress = start_delayed_progress(_("Counting referenced objects"), m->num_objects); for (i = 0; i < m->num_objects; i++) { int pack_int_id = nth_midxed_pack_int_id(m, i); @@ -1235,7 +1235,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla stop_progress(&progress); if (flags & MIDX_PROGRESS) - progress = start_progress(_("Finding and deleting unreferenced packfiles"), + progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"), m->num_packs); for (i = 0; i < m->num_packs; i++) { char *pack_name; diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 7dfff0f8f4..ec87f616c6 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -171,12 +171,12 @@ test_expect_success 'write progress off for redirected stderr' ' ' test_expect_success 'write force progress on for stderr' ' - git multi-pack-index --object-dir=$objdir --progress write 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --progress write 2>err && test_file_not_empty err ' test_expect_success 'write with the --no-progress option' ' - git multi-pack-index --object-dir=$objdir --no-progress write 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --no-progress write 2>err && test_line_count = 0 err ' @@ -333,17 +333,17 @@ test_expect_success 'git-fsck incorrect offset' ' ' test_expect_success 'repack progress off for redirected stderr' ' - git multi-pack-index --object-dir=$objdir repack 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir repack 2>err && test_line_count = 0 err ' test_expect_success 'repack force progress on for stderr' ' - git multi-pack-index --object-dir=$objdir --progress repack 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --progress repack 2>err && test_file_not_empty err ' test_expect_success 'repack with the --no-progress option' ' - git multi-pack-index --object-dir=$objdir --no-progress repack 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --no-progress repack 2>err && test_line_count = 0 err ' @@ -487,7 +487,7 @@ test_expect_success 'expire progress off for redirected stderr' ' test_expect_success 'expire force progress on for stderr' ' ( cd dup && - git multi-pack-index --progress expire 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --progress expire 2>err && test_file_not_empty err ) ' @@ -495,7 +495,7 @@ test_expect_success 'expire force progress on for stderr' ' test_expect_success 'expire with the --no-progress option' ' ( cd dup && - git multi-pack-index --no-progress expire 2>err && + GIT_PROGRESS_DELAY=0 git multi-pack-index --no-progress expire 2>err && test_line_count = 0 err ) ' -- gitgitgadget