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,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 5ADA11F4B4 for ; Wed, 31 Mar 2021 00:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbhCaAMO (ORCPT ); Tue, 30 Mar 2021 20:12:14 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:57881 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbhCaALx (ORCPT ); Tue, 30 Mar 2021 20:11:53 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 1ABC3B0EA4; Tue, 30 Mar 2021 20:11:53 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=YUn+HjjLjNgr vuqavzKBfFRQV54=; b=Sxd/K5sWQ4iylOZ6v4evq6lBLg4DGp2UaPu11JdCHkxK 8Dn8fA+nrYYga6ms6X1oSfm0+AUfOTKvshIUJ2HKeso7ggdSNfx3TL8AFWLEwrz8 fFbMmGS6/eK57eY29h0ksojAzEpn1G5f+2VTSjrTO+xmVFRS8zdfO6O9B+BYxiE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=ukCrqU qqhSFLxKR6dlXEHgQbMNQ6MVUp64U3sKcB3vOaCprcjs69FJsAeEmGJEF+rmnjT6 ZLVt7f0ERqNEGDooc7IFgYOczlgd9s7cBOo0IfkwScmtghuIo94rzOgx0iu+Fklr 9CPUsv+js8E0vDIRogIjZh8UNU1qN3D1mYhu8= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 11C43B0EA3; Tue, 30 Mar 2021 20:11:53 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 8FA28B0EA2; Tue, 30 Mar 2021 20:11:52 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Jeff King , Johannes Schindelin , Carlo Marcelo Arenas =?utf-8?Q?Bel=C3=B3n?= Subject: Re: [PATCH v2 21/22] pickaxe -G: terminate early on matching lines References: <20210203032811.14979-1-avarab@gmail.com> <20210216115801.4773-22-avarab@gmail.com> Date: Tue, 30 Mar 2021 17:11:51 -0700 In-Reply-To: <20210216115801.4773-22-avarab@gmail.com> (=?utf-8?B?IsOGdmFy?= =?utf-8?B?IEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Tue, 16 Feb 2021 12:58:00 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: B1FAE8EA-91B5-11EB-BF06-D152C8D8090B-77302942!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: > Solve a long-standing item for "git log -Grx" of us e.g. finding "+ > str" in the diff context and noting that we had a "hit", but xdiff > diligently continuing to generate and spew the rest of the diff at us. > Nice. "git log -Gpattern" without "-p" has no reason to do the full diff once it finds out that pattern would have existed if "-p" were given in the output. It actually is a bit of shame that "git log -Gpattern -p" still needs to run two diffs (instead of taking advantage of the diff that it needs to generate anyway (to show to the user of the "log") and pattern match in it). > if (data->hit) > + BUG("Already matched in diffgrep_consume! Broken xdiff_emit_line_fn?= "); Hmph, an obvious alternative would be to silently return -1 here, which probably would not hurt, either. I do not mind the check to be stricter, though. > + if (!regexec_buf(data->regexp, line + 1, len - 1, 1, > + ®match, 0)) { > + data->hit =3D 1; > + return -1; > + } > return 0; > }