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-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 5A3841F4DA for ; Wed, 27 Apr 2022 20:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235379AbiD0UHP (ORCPT ); Wed, 27 Apr 2022 16:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235495AbiD0UHC (ORCPT ); Wed, 27 Apr 2022 16:07:02 -0400 Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B53F4338B for ; Wed, 27 Apr 2022 13:03:47 -0700 (PDT) Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id E7B3D19401D; Wed, 27 Apr 2022 16:03:46 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; 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=vUGWjBxRo7jv mCQSle0vboCg2gPe68Sw/jjv//aysk4=; b=bQLbNkIKzpgC5XABz6mLV73vlkuX Wu/JBH3gYwdrneJXJz8x4onFIZX8VZCJOXv+02qP6TOM5TIrjR3RIJm539oiE7/m ZVSb3HIve7DWsmmVnoeJ1LFgxTYxFASOBrW5eY0OMOYjyixCAjjTuieNZs8RhrHQ 2G0XRc1/uxNo2XI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id DFACE19401B; Wed, 27 Apr 2022 16:03:46 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.105.84.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 39D3319401A; Wed, 27 Apr 2022 16:03:43 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?Q?Ren=C3=A9?= Scharfe Cc: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , git@vger.kernel.org, Phillip Wood , Matthias =?utf-8?Q?A=C3=9Fhau?= =?utf-8?Q?er?= Subject: Re: [PATCH] 2.36 gitk/diff-tree --stdin regression fix References: <83a76d46-5069-d6c7-b8b3-f3a063637abb@gmail.com> <6ac7e164-c4ba-0ffc-a8a4-4cede1d4e7ae@gmail.com> <561a73aa-7e94-5a09-0c9c-08e8b6ce7188@web.de> Date: Wed, 27 Apr 2022 13:03:41 -0700 In-Reply-To: (=?utf-8?Q?=22R?= =?utf-8?Q?en=C3=A9?= Scharfe"'s message of "Wed, 27 Apr 2022 20:06:39 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: 23940894-C665-11EC-B291-C85A9F429DF0-77302942!pb-smtp20.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Ren=C3=A9 Scharfe writes: >> + if (prev_options_with_pathspec =3D=3D options && !options->pathspec.= nr) >> + BUG("reused struct diff_options, potentially lost pathspec"); >> + if (options->pathspec.nr) >> + prev_options_with_pathspec =3D options; > > This can report a false positive if a diffopt is reused with different > pathspecs, and one of them is empty (match all). Which could be counte= red > by using a fresh diffopt every time (e.g. pushing it into a loop). The only use case to reset pathspec of a diffopt during iteration I can think of is the hacky[*] version of "git log --follow" where the pathspec is swapped when a rename of a single path being followed is detected. Side note: hacky because the way it swaps a single pathspec upon seeing one rename means it does not work in a mergy-branchy history where one branch renames and there are still commits that need to be explored on the other branch that had the path under its original name.