From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 957021F453 for ; Thu, 1 Nov 2018 23:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbeKBIgu (ORCPT ); Fri, 2 Nov 2018 04:36:50 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43740 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbeKBIgu (ORCPT ); Fri, 2 Nov 2018 04:36:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id t10-v6so145009wrn.10 for ; Thu, 01 Nov 2018 16:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pcthve+9ZrDy1SnfvsXRGrdqlXBznqhGUZy3+LNXmeo=; b=Z0k8iELzTPMwfyM9V01DnXWQj+uMxq+MBd7cWKmao7wVzTWVOUuR0FdkHb4upSaY/M fKjGI1E5qVXZy7SVXeg182m/b5KziaDzQe+7/1TiI1fY+FqwMLioMZzRHEakrd4fozN6 EK/ow4h+63OzH8ZMctxyK+MUQW9u9KXvaNLYvZcEFyFbGGgOb71UsnwSoQtuhhIY0FDN 6P/ZVHONmriN8fal3uvUr309D+lInd7q3pAJ5NV6umqYGo/k0eomb/cwhWVJFascIxcy gbY7vdJlsKTJLQhy+HvpfidF+VjpLWY5bCRCZms6L39RZtx+sSao/+l6/NdB0ZPO9C9k VU4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pcthve+9ZrDy1SnfvsXRGrdqlXBznqhGUZy3+LNXmeo=; b=au9rUDLd6LNQffFnonFVvDwByshGruilGURi3sOdmOVvRQ8CYpauYDou4Mtfr5aFVe S78E6BMhqjCXz4I+wB+H9QPfrWxFYy3nhe3DVpAOIdSb3ZSELYH3wbIThgbvqfxYqEFh MxKyYBEfV/C2GNAG2KSLWTC7LKZ3szqd3veamtQxpk4QV1BvZU6EMS48efAh2dX4m/EW iPCMKm8QkQ+WNCQwtkqv4omc3Cv2dLX+vwar3z9cX1rUd4n7uo6JuqMxZpZjKYV+Umlq 51UKLlS5/FrE5rU1xE+JudRJrfTGD+pSlCTH4rkx88837vbLvYCv+0ou+XfLhyZOKT/w 6S2w== X-Gm-Message-State: AGRZ1gIx1Lk9JWktxXmQd5c/cKnLc6kDygDvi7LSqsd6ttxFQxCpO3ny cNDSFmR82I/MLq4k03XoQ3I= X-Google-Smtp-Source: AJdET5fCJ1YPRxty0yPoAfYFVZ6FcdJgd2vjWH6qwOCaTnqbkhfbmDdVyh0GQt8n/pA0yGbY4hE9Wg== X-Received: by 2002:a5d:6943:: with SMTP id r3-v6mr8033929wrw.323.1541115104366; Thu, 01 Nov 2018 16:31:44 -0700 (PDT) Received: from [192.168.0.104] (atoulouse-658-1-25-2.w86-222.abo.wanadoo.fr. [86.222.24.2]) by smtp.gmail.com with ESMTPSA id k4sm1215732wrx.91.2018.11.01.16.31.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 16:31:43 -0700 (PDT) Subject: Re: [PATCH v2 04/16] sequencer: introduce todo_list_write_to_file() To: phillip.wood@dunelm.org.uk, git@vger.kernel.org Cc: Johannes Schindelin , Junio C Hamano References: <20181007195418.25752-1-alban.gruin@gmail.com> <20181027212930.9303-1-alban.gruin@gmail.com> <20181027212930.9303-5-alban.gruin@gmail.com> <03475c29-5317-b105-6102-5cae3a5ae926@talktalk.net> From: Alban Gruin Openpgp: preference=signencrypt Autocrypt: addr=alban.gruin@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFcsWp4BEAC6dalBNr/CZCvvfeARylnjAaZCxMPwUHXAyf4xotA59sNcyVmaFQ6KxQEs R20CSJhO6HqCh4bR9/994vdc4cGuNaWf82eYRYzqCzwFWvFJHj83QgDR2cjtz4frKpj3jSFJ No3KBlMmpU8yvSnYaCxjqHxBB+fZwkmmONj/57KdFRU83DvDllQdAxXfxEavL3qUKjVbld29 o82M2xsN8ZN5KTw7rAMHcigYVnlrgP50euxz3WvfrV+Mky2W7q7m5rTK7eXqOKhewsKcxo0I AP+H0Nt91YTmMIAX2Ba25IfHI99kUCLpbHX9xdvj5UH1SZsG84APahdI3CXYibfYIS+qssoo 72qj7eBIoCFbVS4Q5AINxojio32orGBDE8CaCy3EzTF+vwJ+h4uUKrTX4wyUMy8nXS0UxZqD aQsS7Di6LdAHu+4uf064mXdgjehJ2uHAydFnCThMoxckRoSZ70iCPwgconhNrnuTmunJ43BF YjAurjg8y3WrMPJuJaI42q0sYbAX21XeayyMI8dzoNwyG6s+v0Udb/uxdYnHhsGx1oXjYCeR nyBdVwdMLWFP4XmJH7JueGUZ37TLh719ME6HYRpfM3sh915ywPxKxQYmGC9iXRThXdGK7ipq hJM5RtMq4QPGg+/ShgTZaDdFuMnG8Zrq6W+O29h9NB5rQ/UvBwARAQABzSNBbGJhbiBHcnVp biA8YWxiYW4uZ3J1aW5AZ21haWwuY29tPsLBsAQTAQIAWgI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qes+C41qpr6H7yn6xE835t5OtJbOiS+af/a8PrWvjv vE2Vztn3QWvHWhbMDB8NjSCNnVsLHyu3qr66meTkJMlJgZA1LcmE+GAM2/HV5z11u779zJHO VQARAQABwsF8BBgBAgAmAhsMFiEEtU9WyxaxXbacZ0yDDgufJVqTVioFAlt76q0FCQYwwioA CgkQDgufJVqTVioQ2A//UEkF5EOPBqV45CMNA5yvq7rBP01CzAJsTExBi2572UBiMDiGt9g6 bRU+coRK8fHWga+U3tO+7ubtnzysBLHOJ6Yq48GcIrFYu9ky0GEaxc3+Nu7muVxHs+ltiaxC EaARhnYGm3MsRjlLwCgGbfjdhajprjdDooA7czE/JZEXrFt3HEUtZw9z9hNh7OJ8ENIYXlFO jtnnlJuCrlKEGN2S9PA4zU6/vSznBUBXNCQzCueBGf09iiuERxTwrmfn65REhUOkE7o9mKp1 4dR4/zuONnLttzIwkuUNGyP2OId/FFeAjrx7sPDPrHaGPBFJ3FBx/VI+3/HCajEIPcM9h3Nk kS1K6xmzsExaR81lYkKyWR/drBT4bv2mmYh4H8ksMCWFecCLPe77ydgStSIqhgtJx53XVyWl aL3vMwzmG3fihq8fUdFxXfQWcUlI++qe/e7Ye8weLTCrNB0TM/T/c6gnQHF1VdIwbMPJVB/Q Up74CgX7geoMmEYmsYH+P0DR/+yBqgiWgpPtLAdD9ALwVgvdQs/zZCvBLrXMLd5kEIbtFoTG +n3xU7zare4Jcz45Tt4/ECsGGIt6rul+J9HBjuCG8STEbmTtlauZmZ4uGf2uxpj0H3cPzwgE 9NQcuwgB9Z4DVNTZYA6LMAi57ITqC84t2RfaYbOk+7iSI1kLBtZzdwU= Message-ID: <8b235228-fa53-cf5d-6ece-b28d030e1751@gmail.com> Date: Fri, 2 Nov 2018 00:31:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <03475c29-5317-b105-6102-5cae3a5ae926@talktalk.net> Content-Type: text/plain; charset=utf-8 Content-Language: fr-FR Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Phillip, Le 30/10/2018 à 17:28, Phillip Wood a écrit : > Hi Alban > > I like the direction this is going, it is an improvement on re-scanning > the list at the end of each function. > > On 27/10/2018 22:29, Alban Gruin wrote: >> This introduce a new function to recreate the text of a todo list from >> its commands, and then to write it to the disk.  This will be useful in >> the future, the buffer of a todo list won’t be treated as a strict >> mirror of the todo file by some of its functions once they will be >> refactored. > > I'd suggest rewording this slightly, maybe something like > > This introduces a new function to recreate the text of a todo list from > its commands and write it to a file. This will be useful as the next few > commits will change the use of the buffer in struct todo_list so it will > no-longer be a mirror of the file on disk. > >> This functionnality can already be found in todo_list_transform(), but > > s/functionnality/functionality/ > >> it is specifically made to replace the buffer of a todo list, which is >> not the desired behaviour.  Thus, the part of todo_list_transform() that >> actually creates the buffer is moved to a new function, >> todo_list_to_strbuf().  The rest is unused, and so is dropped. >> >> todo_list_write_to_file() can also take care to append the help text to > > s/care to append/care of appending/ > >> the buffer before writing it to the disk, or to write only the first n >> items of the list. > > Why/when do we only want to write a subset of the items? > In skip_unnecessary_picks(), in patch [10/16]. It needs to write the elements of the todo list that were already done in the `done' file. > […] >> +int todo_list_write_to_file(struct todo_list *todo_list, const char >> *file, >> +                const char *shortrevisions, const char *shortonto, >> +                int command_count, int append_help, int num, unsigned >> flags) > > This is a really long argument list which makes it easy for callers to > get the parameters in the wrong order. I think append_help could > probably be folded into the flags, I'm not sure what the command_count > is used for but I've only read the first few patches. Maybe it would be > better to pass a struct so we have named fields. > You’re right, command_count is not really needed since we pass the complete todo list. The only bit that irks me is that, if I stop passing command_count, I would have to call count_commands() twice in complete_action(): once to check if there are any commands in the todo list, and again inside of todo_list_write_to_file() (see [09/16].) Perhaps I could move this check before calling todo_list_rearrange_squash()? As a sidenote, this is not why I added command_count to the parameters of todo_list_write_to_file(). It was a confusion of my part. > Best Wishes > > Phillip > Cheers, Alban