From patchwork Wed Nov 1 19:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 13443003 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 AC5CE14291 for ; Wed, 1 Nov 2023 19:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="Tnt0uADi" Received: from ring.crustytoothpaste.net (ring.crustytoothpaste.net [172.105.110.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D80AA2 for ; Wed, 1 Nov 2023 12:24:27 -0700 (PDT) Received: from tapette.crustytoothpaste.net (unknown [IPv6:2001:470:b056:101:5e4a:89fa:93b9:2058]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by ring.crustytoothpaste.net (Postfix) with ESMTPSA id 790F25B0C3; Wed, 1 Nov 2023 19:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1698866666; bh=d7/SsawHBEyrHUH3HyGorZ8rM/63WQ2gGLvrMBhSTLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Content-Type:From: Reply-To:Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To: Resent-Cc:In-Reply-To:References:Content-Type:Content-Disposition; b=Tnt0uADizzP33BCz9nN+HVExNLjqaYnrY9l/BqdzRy4R2uMGnw+9WMLohsBZ8Q02f PTiM/H9dQoicSw5c16UcGEfn7PahmsTcMehSBDFJ2Gec/rmnDKSxVWo0yf5amAtPjq mEsFe8Ejld+mmzkCp5IUnUKBerJ9oaOOKeiNwrpNQ6DkCEcgx+Ab9q0e0OkRkJYvP6 CLw4TBQD2Wg/gOMB7IkDCguBUVaOe0o6y/vK6DFtJjQouB3ArY9tz8ZPnLYHG2dwV8 rF5gVGuvZkdXOyghxFUFeWcku40SUZ1MQVftc9XC4NnhrGgmemmdszbwhTc6liWdLP IgesieZTdRIBXYHKP60kcyB3OZrz6nEr+Ol/AF5rRVPwj8SoRrKGmHGmygDYE6ClMu TlkAN7obJInfK1gxiD+Y4heqKe30hJsSlOMHMBDl5dkrSdhBD+F+WuZcvGsnQB3P5q WDTURKtHBfkaTzA4FK7bAevc0V0r5lF0DD1QT+PW06x2NhSJYbn From: "brian m. carlson" To: Cc: Junio C Hamano , Elijah Newren , Phillip Wood , Eric Sunshine , Taylor Blau , =?utf-8?q?Martin_=C3=85gren?= Subject: [PATCH v3 1/2] git-merge-file doc: drop "-file" from argument placeholders Date: Wed, 1 Nov 2023 19:24:18 +0000 Message-ID: <20231101192419.794162-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231101192419.794162-1-sandals@crustytoothpaste.net> References: <20231024195655.2413191-1-sandals@crustytoothpaste.net> <20231101192419.794162-1-sandals@crustytoothpaste.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Martin Ågren `git merge-file` takes three positional arguments. Each of them is documented as ``. In preparation for teaching this command to alternatively take three object IDs, make these placeholders a bit more generic by dropping the "-file" parts. Instead, clarify early that the three arguments are filenames. Even after the next commit, we can afford to present this file-centric view up front and in the general discussion, since it will remain the default one. Signed-off-by: Martin Ågren Signed-off-by: brian m. carlson --- Documentation/git-merge-file.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt index 7e9093fab6..bf0a18cf02 100644 --- a/Documentation/git-merge-file.txt +++ b/Documentation/git-merge-file.txt @@ -11,19 +11,20 @@ SYNOPSIS [verse] 'git merge-file' [-L [-L [-L ]]] [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=] - [--[no-]diff3] + [--[no-]diff3] DESCRIPTION ----------- -'git merge-file' incorporates all changes that lead from the `` -to `` into ``. The result ordinarily goes into -``. 'git merge-file' is useful for combining separate changes -to an original. Suppose `` is the original, and both -`` and `` are modifications of ``, +Given three files ``, `` and ``, +'git merge-file' incorporates all changes that lead from `` +to `` into ``. The result ordinarily goes into +``. 'git merge-file' is useful for combining separate changes +to an original. Suppose `` is the original, and both +`` and `` are modifications of ``, then 'git merge-file' combines both changes. -A conflict occurs if both `` and `` have changes +A conflict occurs if both `` and `` have changes in a common segment of lines. If a conflict is found, 'git merge-file' normally outputs a warning and brackets the conflict with lines containing <<<<<<< and >>>>>>> markers. A typical conflict will look like this: @@ -36,8 +37,8 @@ normally outputs a warning and brackets the conflict with lines containing If there are conflicts, the user should edit the result and delete one of the alternatives. When `--ours`, `--theirs`, or `--union` option is in effect, -however, these conflicts are resolved favouring lines from ``, -lines from ``, or lines from both respectively. The length of the +however, these conflicts are resolved favouring lines from ``, +lines from ``, or lines from both respectively. The length of the conflict markers can be given with the `--marker-size` option. The exit value of this program is negative on error, and the number of @@ -62,7 +63,7 @@ OPTIONS -p:: Send results to standard output instead of overwriting - ``. + ``. -q:: Quiet; do not warn about conflicts. From patchwork Wed Nov 1 19:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 13443004 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 329D118E06 for ; Wed, 1 Nov 2023 19:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="V6MQ8HI7" Received: from ring.crustytoothpaste.net (ring.crustytoothpaste.net [172.105.110.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A3F102 for ; Wed, 1 Nov 2023 12:24:27 -0700 (PDT) Received: from tapette.crustytoothpaste.net (unknown [IPv6:2001:470:b056:101:5e4a:89fa:93b9:2058]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by ring.crustytoothpaste.net (Postfix) with ESMTPSA id 8D86A5B0C4; Wed, 1 Nov 2023 19:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1698866666; bh=iwASfeCYO9WW/5C7sgWaSjU5KBjClYpCNCiaQo8ORrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=V6MQ8HI7EB+x6TXp6EmKxOOBd89h4ydQ8svXdNJuLU6A5Max6N5PPUgrp+rPXqOE4 KPpzPqbH4AddVHgmK5zI0LXnsjlcHOplc4A/yuD5lmwq4gdlAmZzH3J1RTA8i8+vss TFxtuffq0XM+4DwLaCdEiS0XlHUlSBJF5wZwWJVEWWrW1sJv5Rg6Pp7Q6PpsQ8wXRu fpYVTsOW0GXo6/6cl1aoJSWlJVATFwo1sgDJjEaagNeLc8HNkxrYfc32iXMo2n5hWc /Gj+pNl0nLdoxbeIpuOYQ14d1D62moQaa9RmrNitFeAdTvl5OFNo0w3zsRqxS8wDu5 SyzDSzIm2bHbL63XqypoJqNt0X+RebSjcbGl14Cc6Suqauj+kj7W1rq3ICdnVO2y6L CrFtJB76/sw/h4fo4unKfQXUSB5JM1TP9mQ+fE0oxznIkbFC2R242vh3EEFeozGbzT pMz8DlPsyjqJzllg1xwiZoXpnvTCn4F/4+MNWs1z1bZFR2zy+ex From: "brian m. carlson" To: Cc: Junio C Hamano , Elijah Newren , Phillip Wood , Eric Sunshine , Taylor Blau , =?utf-8?q?Martin_=C3=85gren?= Subject: [PATCH v3 2/2] merge-file: add an option to process object IDs Date: Wed, 1 Nov 2023 19:24:19 +0000 Message-ID: <20231101192419.794162-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231101192419.794162-1-sandals@crustytoothpaste.net> References: <20231024195655.2413191-1-sandals@crustytoothpaste.net> <20231101192419.794162-1-sandals@crustytoothpaste.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "brian m. carlson" git merge-file knows how to merge files on the file system already. It would be helpful, however, to allow it to also merge single blobs. Teach it an `--object-id` option which means that its arguments are object IDs and not files to allow it to do so. We handle the empty blob specially since read_mmblob doesn't read it directly and otherwise users cannot specify an empty ancestor. Signed-off-by: brian m. carlson --- Documentation/git-merge-file.txt | 19 +++++++++- builtin/merge-file.c | 62 +++++++++++++++++++++++--------- t/t6403-merge-file.sh | 58 ++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 17 deletions(-) diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt index bf0a18cf02..6a081eacb7 100644 --- a/Documentation/git-merge-file.txt +++ b/Documentation/git-merge-file.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git merge-file' [-L [-L [-L ]]] [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=] - [--[no-]diff3] + [--[no-]diff3] [--object-id] DESCRIPTION @@ -41,6 +41,10 @@ however, these conflicts are resolved favouring lines from ``, lines from ``, or lines from both respectively. The length of the conflict markers can be given with the `--marker-size` option. +If `--object-id` is specified, exactly the same behavior occurs, except that +instead of specifying what to merge as files, it is specified as a list of +object IDs referring to blobs. + The exit value of this program is negative on error, and the number of conflicts otherwise (truncated to 127 if there are more than that many conflicts). If the merge was clean, the exit value is 0. @@ -53,6 +57,14 @@ linkgit:git[1]. OPTIONS ------- +--object-id:: + Specify the contents to merge as blobs in the current repository instead of + files. In this case, the operation must take place within a valid repository. ++ +If the `-p` option is specified, the merged file (including conflicts, if any) +goes to standard output as normal; otherwise, the merged file is written to the +object store and the object ID of its blob is written to standard output. + -L