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, 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 5D67D1F5AE for ; Thu, 23 Jul 2020 23:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbgGWXKI (ORCPT ); Thu, 23 Jul 2020 19:10:08 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55571 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgGWXKI (ORCPT ); Thu, 23 Jul 2020 19:10:08 -0400 Received: by mail-wm1-f65.google.com with SMTP id 9so6363040wmj.5 for ; Thu, 23 Jul 2020 16:10:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bL3AcsKJDiHSw7S4BoceLsO9odGTdhpSTCuf8HpDKD8=; b=Frdilb1pXFm0hcqalBktogHNMjPVQL7X/BBoj1g5Ejzcc8rNTklj0YJuql8Zx05Oge ZFHH8L6AddbWQTyAyg5FSwcnZMH2E2S7DwkVC2kNGLljT/xtu1XQP595gsYErHkfWiFd WstG0YxC/Nr81cpoHlqCNBxl3tcg7leTf7yzQ0nI48w60/Lk98ZQsRSCyke1FGbgTe0Z NLrN+4I9hN2a/B+vU7/t4udoJ/QW8PEqSSiPl91EzP6D7/40ujbNNj/oHe1/Ul5gh4ED DMENWcmdc0DgqHdcOZVcY6P1vCzdZhv8qq6tn3oiynPkdiB3xLZKxQJsl0SnZHH1Cf6t KCww== X-Gm-Message-State: AOAM531+NSBBlOh6n8uFVk7JqoQG9WbB+aM7JTXuBUks/l8e8GIo9ifu gFbuZkBrJ70JUzEqdgJtMEZHe2q0XZ8neQ04CNc= X-Google-Smtp-Source: ABdhPJyccJc12vSPI1H5i5WP36wq0XaFcZv1HR7JWdvIlxtlJR1m9wiOaMo0BaVwe3F18SDd7ZpuHmBYWN391DT5UtM= X-Received: by 2002:a1c:3504:: with SMTP id c4mr6023340wma.177.1595545806557; Thu, 23 Jul 2020 16:10:06 -0700 (PDT) MIME-Version: 1.0 References: <478c7f1d0b858755c2c4b98605405214910b6f4c.1595527000.git.gitgitgadget@gmail.com> In-Reply-To: From: Eric Sunshine Date: Thu, 23 Jul 2020 19:09:55 -0400 Message-ID: Subject: Re: [PATCH v2 11/18] maintenance: auto-size incremental-repack batch To: Junio C Hamano Cc: Derrick Stolee via GitGitGadget , Git List , Johannes Schindelin , "brian m. carlson" , steadmon@google.com, Jonathan Nieder , Jeff King , Doan Tran Cong Danh , Phillip Wood , Emily Shaffer , Son Luong Ngoc , Jonathan Tan , Derrick Stolee , Derrick Stolee Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Jul 23, 2020 at 6:15 PM Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" writes: > > + struct strbuf batch_arg = STRBUF_INIT; > > + > > - argv_array_push(&cmd, "--batch-size=0"); > > + strbuf_addf(&batch_arg, "--batch-size=%"PRIuMAX, > > + (uintmax_t)get_auto_pack_size()); > > + argv_array_push(&cmd, batch_arg.buf); > > > > + strbuf_release(&batch_arg); > > I think I saw a suggestion to use xstrfmt() with free() instead of > the sequence of strbuf_init(), strbuf_addf(), and strbuf_release() > in a similar but different context. Perhaps we should follow suit > here, too? Perhaps I'm missing something obvious, but wouldn't argv_array_pushf() be even simpler? argv_array_pushf(&cmd, "--batch-size=%"PRIuMAX, (uintmax_t)get_auto_pack_size());