From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 5EFC51F44D for ; Thu, 14 Mar 2024 17:19:50 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=sasl header.b=pkKTzdo0; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B50E41C2097C for ; Thu, 14 Mar 2024 17:19:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2669C745F0; Thu, 14 Mar 2024 17:19:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="pkKTzdo0" Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA91974400 for ; Thu, 14 Mar 2024 17:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=173.228.157.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710436770; cv=none; b=B+6AenQuKkkUOTXsYpU8BHrufKPfVwAybsLgRLcIv7UBS2+Fs2JZ9l/3qanpYvrM78u0oYvApvVYZ3fQXwBwfmtSHps9rp92d11mLeL1SYkYIP+by/vSuuqt1nrT4JKBPDL0IDBVFWENn1BAF2qe5MLQBBti8Ng+KVFiRTln5x4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710436770; c=relaxed/simple; bh=IQMQqBwtDvcUv0kQAQ1y3jKa+pIZ2Tf26Rwc0Agt/rQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=uvTteA5pJkioa3SVu0ntKxg5LhmrW44bzKYxxDut6T1pOLxIid8APWsRXIrMJSH4NVI2CIigDlso91wSnFfU0dcHBP4Olv+4vqtcQxNTYWSWACe5ND8cXMosOoAyuKSLeSwyhnVSBPXWhJbPpx75GHbKXKvr1fRTdJHTFB6dz8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=pkKTzdo0; arc=none smtp.client-ip=173.228.157.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 1C8852335D; Thu, 14 Mar 2024 13:19:28 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=IQMQqBwtDvcUv0kQAQ1y3jKa+pIZ2Tf26Rwc0A gt/rQ=; b=pkKTzdo0UbY6xwiZY2mzS1OFii1JwgS9ghajGqQsEu7tMlVFqd8FAk rxQQ07vXqKr9C2HdlNivTXWhZbO4F/8/1taKIlfRxPV1BCl7q00Da2dxvg/s8uaz au70c6y3yCjdQdedKzQfcDpJ9fPXnAnAJt7M4EblF9MQNI9/B/XSc= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 14FCA2335C; Thu, 14 Mar 2024 13:19:28 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.125.185.65]) (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 AF5922335A; Thu, 14 Mar 2024 13:19:24 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: "Phillip Wood via GitGitGadget" Cc: git@vger.kernel.org, Elijah Newren , Phillip Wood Subject: Re: [PATCH v2 1/5] xdiff-interface: refactor parsing of merge.conflictstyle In-Reply-To: <629e577879c550aafffeb0f75a64c9a2a95df512.1710435907.git.gitgitgadget@gmail.com> (Phillip Wood via GitGitGadget's message of "Thu, 14 Mar 2024 17:05:03 +0000") References: <629e577879c550aafffeb0f75a64c9a2a95df512.1710435907.git.gitgitgadget@gmail.com> Date: Thu, 14 Mar 2024 10:19:23 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 013B77AC-E227-11EE-AA00-F515D2CDFF5E-77302942!pb-smtp20.pobox.com "Phillip Wood via GitGitGadget" writes: > From: Phillip Wood > > Factor out the code that parses of conflict style name so it can be > reused in a later commit that wants to parse the name given on the > command line. > > Signed-off-by: Phillip Wood > --- > xdiff-interface.c | 29 ++++++++++++++++++----------- > xdiff-interface.h | 1 + > 2 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/xdiff-interface.c b/xdiff-interface.c > index 3162f517434..16ed8ac4928 100644 > --- a/xdiff-interface.c > +++ b/xdiff-interface.c > @@ -305,6 +305,22 @@ int xdiff_compare_lines(const char *l1, long s1, > return xdl_recmatch(l1, s1, l2, s2, flags); > } > > +int parse_conflict_style_name(const char *value) > +{ > + if (!strcmp(value, "diff3")) > + return XDL_MERGE_DIFF3; > + else if (!strcmp(value, "zdiff3")) > + return XDL_MERGE_ZEALOUS_DIFF3; > + else if (!strcmp(value, "merge")) > + return 0; > + /* > + * Please update _git_checkout() in git-completion.bash when > + * you add new merge config > + */ > + else > + return -1; > +} As these symbols are now more public, it is tempting to leave a #leftoverbits mark to remind us to clean them up by adding XDL_MERGE_MERGE (instead of 0) and XDL_MERGE_UNKNOWN (instead of -1) after the dust settles. That would have made reading later patches in the series a little less puzzling. But within the scope of this series, the above is perfect, faithful refactoring of the original.