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.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, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id F2B5D1F47D for ; Mon, 6 Mar 2023 18:28:42 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; secure) header.d=web.de header.i=l.s.r@web.de header.a=rsa-sha256 header.s=s29768273 header.b=idJ7ANMv; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230086AbjCFS2k (ORCPT ); Mon, 6 Mar 2023 13:28:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjCFS2h (ORCPT ); Mon, 6 Mar 2023 13:28:37 -0500 Received: from mout.web.de (mout.web.de [212.227.15.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F4239CC8 for ; Mon, 6 Mar 2023 10:28:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1678127283; i=l.s.r@web.de; bh=qIXI8K6KwOCO2uoKVig+uPoTHrGO7v/LLqpIZVRKmjU=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=idJ7ANMvw7Q3tf0yuZiwxZ0e80bOPt6FmaFOzAxrvTaS0Z8Xe0+4u46FpGv2BzA2Y 6PfE8iWXt/c3f0MvRE4sDqan86cfRyoBeOrJ2GYNBCV139XYM8li41nHNQOphgKnHd H+1VkWB9d4D7A0V3qlSrr16EvA5iYeA/wj4IzWAf9/GAJbHhYTvghDXs9Mqnd9Cccq jGwS5kAxK7gI3wUVLN56dtMVgZbONUGHaiuLiG34kJ0opCFvRdzWucZRCfoRwBdXH3 Ws4fBp1UfOyTnN4OjWBrrUfeS/rJAKTiIPoUXqtZJj5+xnnU41wFUYs7dr8lp3QLnY 0rUgn25kQbAVQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([79.203.29.151]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N4vRY-1qXvDr0nbg-0117b7; Mon, 06 Mar 2023 19:28:03 +0100 Message-ID: Date: Mon, 6 Mar 2023 19:28:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Bug in git archive + .gitattributes + relative path Content-Language: en-US To: Junio C Hamano Cc: Cristian Le , git@vger.kernel.org References: <42f13cda-9de6-bfc6-7e81-64c94f5640db@mpsd.mpg.de> <8d04019d-511f-0f99-42cc-d0b25720cd71@mpsd.mpg.de> <70f10864-2cc7-cb9e-f868-2ac0011cad58@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:gXK2L2xuFR9eGjKkzP3JVzbS2tPm8fUputFAHPv8spJB9gZbNYM y8UWNyYAFDhymyWI3nVod/BL3HnvqRyipmQvlBKEXju/gkuz1LbizeSvVjNZ0dk4E+YXmfD 7Hg7kBd+fqDl63c+rmqHhfFIdod+fF+D/U6Lk/aeaGTv93SQczQgafR621z/hRSyJC2tOHy C3x8A7Qs0UHvHqVl5mrwg== UI-OutboundReport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03.23 um 18:27 schrieb Junio C Hamano: > Ren=C3=A9 Scharfe writes: > >> Subject: [PATCH] archive: add --strip-components >> >> Allow removing leading elements from paths of archive entries. That's >> useful when archiving sub-directories and not wanting to keep the >> common path prefix, e.g.: >> >> $ git archive --strip-components=3D1 HEAD sha1dc | tar tf - >> .gitattributes >> LICENSE.txt >> sha1.c >> sha1.h >> ubc_check.c >> ubc_check.h >> >> The same can be achieved by specifying a tree instead of a commit and >> a pathspec: >> >> $ git archive HEAD:sha1dc | tar tf - >> .gitattributes >> LICENSE.txt >> sha1.c >> sha1.h >> ubc_check.c >> ubc_check.h > > Another way I am not sure is working as designed is > > $ cd sha1dc && git archive HEAD . | tar tf - > .gitattributes > LICENSE.txt > sha1.c > sha1.h > ubc_check.c > ubc_check.hq > > I didn't check if the attribute look-up is done on the correct path > or export-subst kicks in in such a use, though. export-subst is supported in that invocation because git archive has a commit to work with. I can kinda see others preferring the directory prefix "sha1dc/" added to those entries. Perhaps it depends on what git archive is supposed to archive: A commit or the files of a commit? I'm in the latter camp, and expect to see the same paths as given by git ls-files or git ls-tree. But that invocation in a sub-directory probably has the same problem with attributes as the one with a sub-tree above it, i.e. that attributes are always looked up relative to the repository root. I wonder if 47cfc9bd7d (attr: add flag `--source` to work with tree-ish, 2023-01-14) provided the means to fix this when it added a tree_oid parameter to git_check_attr(). Ren=C3=A9