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=-4.0 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 6D0D81F990 for ; Thu, 6 Aug 2020 17:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbgHFRwc (ORCPT ); Thu, 6 Aug 2020 13:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbgHFQbT (ORCPT ); Thu, 6 Aug 2020 12:31:19 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5A0C00217F for ; Thu, 6 Aug 2020 09:30:33 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id 184so10292134wmb.0 for ; Thu, 06 Aug 2020 09:30:33 -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=xhHyMPCS+Bkr8AVPcmA1SDmyfDPL8Ap9sHZ0eLhZcd4=; b=oNh+139ruN91+fwMmoVKNAA3gjeVXlHiTbZ+l+t90iEWVlVsjggSveMso8RQe3NBnn Mh7eLbpeEJJkNk980SyKs72NtyjSVTforuQIp+T1v6NIXnnQ0+yMqaID+T+PhfzQk7b2 ex/w/xmgBjwv+EjZDH5szkU3MNr1ZZvo7hZDYk0VQVHizEAUt0kE+ZElsNB7CZURzPaL 6DtC3c+Raz9BbLz9snOM9JKMzkrzyYXqBrbTAxcu5EvLkgp5MRYsazH3W/qAFjxKGNnj I846fKX6qqxYs4hVfQakrXALAcUAeWIHYaFhWhaQRKI983YORcEm5zW7tq0XMGflfzir zrTg== 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=xhHyMPCS+Bkr8AVPcmA1SDmyfDPL8Ap9sHZ0eLhZcd4=; b=jPsyvHDHAViQwo5IOboRpuBvFx0FT7bppY7pYksIxQYoOPLgkJd7ru1k4F9qyRsHiq eAgHJchvJDiwgw1PbytJ7VVR5XAfCJms3NBUVmxUXwUlzhT/VMReNmi20RPen7/iSdkQ Fvcppgj3RJ5NZXyy+A5jTFYNjP40dfMRu2nWyTBcOEXiD/KuLMlqZEYSsu833Gs3AYk3 57poz2oLSu/Oolrsx8CqHWmlBMCTyqzZ/ZTa71DFeY+YWEm7XXxn4BZewcZV/Nlun/mc OEqVwI000niYhPm1JdD04Cbfk51cOOb1EZ6sf1etVu7tjbG3apI3H3MZXhA7WbT9YWN/ 0MuA== X-Gm-Message-State: AOAM532oLNz7NHoib6hVDteZOW4DvfKZrtUX5V6bp65ZHTCulsEbYb7f Jax4jG0jf5b3bUNvI41js/iPpZ1t X-Google-Smtp-Source: ABdhPJzcdfaM6eG6dMM3vFswk5ElHqNXBUE4TYaFPY5hvoy53/2BiqfgXcL21X/R+UOr2S9Q81JDTA== X-Received: by 2002:a1c:3983:: with SMTP id g125mr8207572wma.64.1596731430820; Thu, 06 Aug 2020 09:30:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d23sm7056846wmd.27.2020.08.06.09.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 09:30:30 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Thu, 06 Aug 2020 16:30:21 +0000 Subject: [PATCH 6/9] 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, Derrick Stolee , Derrick Stolee Sender: git-owner@vger.kernel.org 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 7214cab36c..12f41dfc18 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -172,12 +172,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 ' @@ -334,17 +334,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 ' @@ -488,7 +488,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 ) ' @@ -496,7 +496,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