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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,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 254C11F5AE for ; Fri, 11 Jun 2021 03:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhFKDiN (ORCPT ); Thu, 10 Jun 2021 23:38:13 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:58212 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhFKDiM (ORCPT ); Thu, 10 Jun 2021 23:38:12 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 8B005133612; Thu, 10 Jun 2021 23:36:14 -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; s=sasl; bh=wOBjT+JwVwZWpSWCFwA0L9ODzLjHp/JEzUSGHn rV1mI=; b=Fp7DFohqb+rAZaLjYIbWIp+gb2/Uq1EzFZcqyjqaZlkNCz0QSLVUFL vjQvnF5j8HXaWvkBq6cYi5nGS4H89z+jZiRjI7Ptzf0pdc+c8tHfaNdoYmjBlne7 p8z6YLoJQsLqLPgDqFkM5jrYjD9d1shnlAiU/R7rS1Jy0DUenzm0Y= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 84EDB133611; Thu, 10 Jun 2021 23:36:14 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.196.172.107]) (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 C856B133610; Thu, 10 Jun 2021 23:36:11 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Jeff King Cc: git@vger.kernel.org Subject: Re: [PATCH 1/2] ll_binary_merge(): handle XDL_MERGE_FAVOR_UNION References: Date: Fri, 11 Jun 2021 12:36:10 +0900 In-Reply-To: (Jeff King's message of "Thu, 10 Jun 2021 08:57:05 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 2ACADA12-CA66-11EB-91B4-D5C30F5B5667-77302942!pb-smtp20.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Jeff King writes: > Prior to commit a944af1d86 (merge: teach -Xours/-Xtheirs to binary > ll-merge driver, 2012-09-08), we always reported a conflict from > ll_binary_merge() by returning "1" (in the xdl_merge and ll_merge code, > this value is the number of conflict hunks). After that commit, we > report zero conflicts if the "variant" flag is set, under the assumption > that it is one of XDL_MERGE_FAVOR_OURS or XDL_MERGE_FAVOR_THEIRS. > > But this gets confused by XDL_MERGE_FAVOR_UNION. We do not know how to > do a binary union merge, but erroneously report no conflicts anyway (and > just blindly use the "ours" content as the result). > > Let's tighten our check to just the cases that a944af1d86 meant to > cover. This fixes the union case (which existed already back when that > commit was made), as well as future-proofing us against any other > variants that get added later. Makes sense. > Note that you can't trigger this from "git merge-file --union", as that > bails on binary files before even calling into the ll-merge machinery. > The test here uses the "union" merge attribute, which does erroneously > report a successful merge. Nice discovery. Thanks.