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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 6D8B71F5AD for ; Tue, 7 Apr 2020 23:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgDGXoY (ORCPT ); Tue, 7 Apr 2020 19:44:24 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:51782 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgDGXoY (ORCPT ); Tue, 7 Apr 2020 19:44:24 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 75EC1CA8AB; Tue, 7 Apr 2020 19:44:22 -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; s=sasl; bh=VuxpLkii3zJun5V9iEuOa+heN6M=; b=q93roY OoN9dY2HWWV/Z74LJlVsO9PAhtzRkvUP1RVmLmeOMp28J4qADdrQreT6aZCL70o0 CavkcbzBQ8HWKcH9DEKCu4RRYpCunVbpU+1BNvxdr0+FCej5dJahFw0qCrZRl1Fl 4BQsbWOH/BSlUOQ+/HqOvf+UjcByIs0cM/G9c= 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; q=dns; s=sasl; b=q4G0n9oNPD6QQZHD0JPNY14Sid2DozOr gBgp7dJ6FmMHw43tVe8gsrzbw48YKzJaJC6U4OEC3cSqDuutD/3EIJCzvyMwAlo/ 1wAhtLF0ONSfYf1mc87hoR2wm535ZV6WoUQfl/INGBTMOKejFyzXQk3rSvdRJamG SrEhuhJ6dM8= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 6E61BCA8AA; Tue, 7 Apr 2020 19:44:22 -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-smtp20.pobox.com (Postfix) with ESMTPSA id B91D6CA8A9; Tue, 7 Apr 2020 19:44:19 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Jonathan Tan Cc: git@vger.kernel.org, garimasigit@gmail.com Subject: Re: [PATCH v3 2/4] diff: make diff_populate_filespec_options struct References: <20200331020418.55640-1-jonathantanmy@google.com> Date: Tue, 07 Apr 2020 16:44:18 -0700 In-Reply-To: (Jonathan Tan's message of "Tue, 7 Apr 2020 15:11:41 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: B3585F38-7929-11EA-87CD-B0405B776F7B-77302942!pb-smtp20.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Jonathan Tan writes: > The behavior of diff_populate_filespec() currently can be customized > through a bitflag, but a subsequent patch requires it to support a > non-boolean option. Replace the bitflag with an options struct. Hmph, clever :-). > + struct diff_populate_filespec_options dpf_options = { > + .check_size_only = 1, > + }; I would have called this instance of d-p-f-o "check_size_only", which would make the site that uses it ... > if (!DIFF_FILE_VALID(one)) > return 0; > - diff_populate_filespec(r, one, CHECK_SIZE_ONLY); > + diff_populate_filespec(r, one, &dpf_options); ... easier to understand, especially if we can made it constant, but that would probably contradict the plan to add more fields to the structure, so let's see how it goes. > @@ -3339,13 +3346,17 @@ static void emit_binary_diff(struct diff_options *o, > int diff_filespec_is_binary(struct repository *r, > struct diff_filespec *one) > { > + struct diff_populate_filespec_options dpf_options = { > + .check_binary = 1, > + }; > + The same comment applies to here, too.