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=-4.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_CSS, URIBL_CSS_A 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 232B41F4D7 for ; Sat, 28 May 2022 06:59:19 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=web.de header.i=@web.de header.b="V6OnDG22"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240603AbiE1G6V (ORCPT ); Sat, 28 May 2022 02:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242410AbiE1G6S (ORCPT ); Sat, 28 May 2022 02:58:18 -0400 Received: from mout.web.de (mout.web.de [212.227.15.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F78183A5 for ; Fri, 27 May 2022 23:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1653721069; bh=CKghe6N1+QakRBnOZhxYDjO2q35CDjK2Qz72l7aS2tg=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=V6OnDG22Pyi6JyPMyfd/nbHFZ7Mx4c+LcmvumMWsG4tjvVH16H83aIBGqyEk7x4oZ o8u/AKnPIPVvmokVXeWSeAC58sXsuwoXxdXiKljmuo4gcee7xwkRW58wLqQ60uDUw7 Fh6SIdpoG5gVQEF3+Bxp72/adiY65BcWoa2uRsD8= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.29] ([79.203.31.99]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MEUWM-1o23Fv0GSo-00GSqo; Sat, 28 May 2022 08:57:49 +0200 Message-ID: <6ef7f836-45f6-8386-03c0-dc18b125ec67@web.de> Date: Sat, 28 May 2022 08:57:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v6 1/7] archive: optionally add "virtual" files Content-Language: en-US To: Junio C Hamano Cc: Johannes Schindelin via GitGitGadget , git@vger.kernel.org, Taylor Blau , Derrick Stolee , Elijah Newren , rsbecker@nexbridge.com, =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Johannes Schindelin References: <0005cfae31d52a157d4df5ba3db9f9f5b2167ddc.1653145696.git.gitgitgadget@gmail.com> <7815a07a-da2f-d348-4179-6dc5b1d5fee6@web.de> <71ae5983-6ef8-fe28-46ab-1675e819ce8b@web.de> From: =?UTF-8?Q?Ren=c3=a9_Scharfe?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:q0xm3oDczUUYzpeBxDDxI6TrA8LB1dUhRdnLz+1uWBUexW+WMv/ E+yEUoL4U2050BaXxCMH4GxFmcg/ScS+wmbUGPqIFBsz6mS3wOyVhXlMQAOSVr8Sk0TdARx +DKfSMaXKKgiuxKi9bvR7eA47u6uEjROHjWsdN5qSlik0eYG2E4dvDk4zDDecf6MoHVgyca aH0CHelsdf6SHf5y2XPjw==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TdH6ZugRJBA8yoiSiDKXIBRR zNRYrgzx6Sr/px/lhwokErli76/4Y6begRlTyJvYe//TfMJzYa+bxMkvkocUUroHrya4HFr+4 WWfgT/3RENF+b7IGnTWV9YhaD+gNJ9uutl/ Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 27.05.22 um 21:01 schrieb Junio C Hamano: > Ren=C3=A9 Scharfe writes: > >> --prefix=3D/:: >> - Prepend / to each filename in the archive. >> + Prepend / to paths in the archive. Can be repeated; its >> + leftmost value is used for all tracked files. See below which >> + value gets used by `--add-file`. > > Doesn't "the last one wins" take the rightmost one? Ha ha! Classic mistake, I do that all the time, especially when in a hurry. >_< > >> @@ -58,8 +60,9 @@ OPTIONS >> --add-file=3D:: >> Add a non-tracked file to the archive. Can be repeated to add >> multiple files. The path of the file in the archive is built >> - by concatenating the value for `--prefix` (if any) and the >> - basename of . >> + by concatenating the value of the leftmost `--prefix` option to >> + the right of this `--add-file` (if any) and the basename of >> + . > > It is not what archive.c::add_file_cb() seems to be doing, though > > It is passed the pointer to "base" that is on-stack of > parse_archive_args(), which is the same variable that is used to > remember the latest value that was given to "--prefix". Then it > concatenates the argument it received after that base value, so > > by concatenating the value of the last "--prefix" seen on the > command line (if any) before this `--add-file` and the basename > of . > > probably. I always get my left and right mixed up X-<. You too? So yeah, avoiding the terms is appealing. > >> @@ -194,6 +197,12 @@ EXAMPLES >> commit on the current branch. Note that the output format is >> inferred by the extension of the output file. >> >> +`git archive -o latest.tar --prefix=3Dbuild/ --add-file=3Dconfigure --= prefix=3D HEAD`:: >> + >> + Creates a tar archive that contains the contents of the latest >> + commit on the current branch with no prefix and the untracked >> + file 'configure' with the prefix 'build/'. >> + >> `git config tar.tar.xz.command "xz -c"`:: >> >> Configure a "tar.xz" format for making LZMA-compressed tarfiles. > > Thanks. > > This patch probably needs to come before the "scalar diagnose" > series, which we haven't heard much about recently (no, I am not > complaining---we all heard that Dscho is busy). > > =2D-- >8 --- Subject: [PATCH v3] archive: improve documentation of --prefix Document the interaction between --add-file and --prefix by giving an example. Helped-by: Junio C Hamano Signed-off-by: Ren=C3=A9 Scharfe =2D-- Documentation/git-archive.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index bc4e76a783..94519aae23 100644 =2D-- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -49,7 +49,9 @@ OPTIONS Report progress to stderr. --prefix=3D/:: - Prepend / to each filename in the archive. + Prepend / to paths in the archive. Can be repeated; its + rightmost value is used for all tracked files. See below which + value gets used by `--add-file`. -o :: --output=3D:: @@ -57,9 +59,9 @@ OPTIONS --add-file=3D:: Add a non-tracked file to the archive. Can be repeated to add - multiple files. The path of the file in the archive is built - by concatenating the value for `--prefix` (if any) and the - basename of . + multiple files. The path of the file in the archive is built by + concatenating the value of the last `--prefix` option (if any) + before this `--add-file` and the basename of . --worktree-attributes:: Look for attributes in .gitattributes files in the working tree @@ -194,6 +196,12 @@ EXAMPLES commit on the current branch. Note that the output format is inferred by the extension of the output file. +`git archive -o latest.tar --prefix=3Dbuild/ --add-file=3Dconfigure --pre= fix=3D HEAD`:: + + Creates a tar archive that contains the contents of the latest + commit on the current branch with no prefix and the untracked + file 'configure' with the prefix 'build/'. + `git config tar.tar.xz.command "xz -c"`:: Configure a "tar.xz" format for making LZMA-compressed tarfiles. =2D- 2.35.3