From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 695791FBB0 for ; Thu, 1 Sep 2016 08:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750957AbcIAIqU (ORCPT ); Thu, 1 Sep 2016 04:46:20 -0400 Received: from mout.gmx.net ([212.227.15.19]:51050 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753891AbcIAIp7 (ORCPT ); Thu, 1 Sep 2016 04:45:59 -0400 Received: from virtualbox ([37.24.141.250]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0Mbxdm-1bM43y3fFO-00JLXp; Thu, 01 Sep 2016 10:45:52 +0200 Date: Thu, 1 Sep 2016 10:45:51 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: =?UTF-8?Q?Jakub_Nar=C4=99bski?= cc: git@vger.kernel.org, Junio C Hamano Subject: Re: [PATCH 13/22] sequencer: remember the onelines when parsing the todo file In-Reply-To: <52d61bef-668b-fdc4-30b3-a34c11b39f81@gmail.com> Message-ID: References: <12bffd6ca4eb7acc00a102d13348bb96ad08371d.1472457609.git.johannes.schindelin@gmx.de> <52d61bef-668b-fdc4-30b3-a34c11b39f81@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-843252816-1472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syOq2Um3IpJgSwcUX2WJx3Aodz4cU9B6bXGaAg OjP5S86 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-843252816-1472719552=:129229 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Hi Kuba, On Wed, 31 Aug 2016, Jakub Nar=C4=99bski wrote: > W dniu 29.08.2016 o 10:05, Johannes Schindelin pisze: >=20 > > The `git-rebase-todo` file contains a list of commands. Most of those > > commands have the form > >=20 > > =09 > >=20 > > The is displayed primarily for the user's convenience, as > > rebase -i really interprets only the part. However, there > > are *some* places in interactive rebase where the is used to > > display messages, e.g. for reporting at which commit we stopped. > >=20 > > So let's just remember it when parsing the todo file; we keep a copy of > > the entire todo file anyway (to write out the new `done` and > > `git-rebase-todo` file just before processing each command), so all we > > need to do is remember the begin and end offsets. >=20 > Actually what we remember is pointer and length, or begin offset and leng= th, > not offset and offset. Right. Fixed. > > diff --git a/sequencer.c b/sequencer.c > > index 06759d4..3398774 100644 > > --- a/sequencer.c > > +++ b/sequencer.c > > @@ -709,6 +709,8 @@ static int read_and_refresh_cache(struct replay_opt= s *opts) > > struct todo_item { > > =09enum todo_command command; > > =09struct commit *commit; > > +=09const char *arg; > > +=09int arg_len; >=20 > Why 'arg', and not 'oneline', or 'subject'? > I'm not saying it is bad name. Because we will use it for `exec` commands' args, too. Clarified in the commit message. > > @@ -760,6 +762,9 @@ static int parse_insn_line(struct todo_item *item, = const char *bol, char *eol) > > =09status =3D get_sha1(bol, commit_sha1); > > =09*end_of_object_name =3D saved; > > =20 > > +=09item->arg =3D end_of_object_name + strspn(end_of_object_name, " \t"= ); > > +=09item->arg_len =3D (int)(eol - item->arg); > > + >=20 > Does it work correctly for line without , that is >=20 > =09 >=20 > I think it does, but I not entirely sure. It does work correctly: in the example, *end_of_object_name would be '\n', and strspn(end_of_object_name, " \t") would return 0. Thanks for the review! Dscho --8323329-843252816-1472719552=:129229--