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 0D05D1F428 for ; Sat, 18 Mar 2023 21:31:53 +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=NzJCEb7p; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbjCRVal (ORCPT ); Sat, 18 Mar 2023 17:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjCRVak (ORCPT ); Sat, 18 Mar 2023 17:30:40 -0400 Received: from mout.web.de (mout.web.de [217.72.192.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CC5211DC for ; Sat, 18 Mar 2023 14:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1679175025; i=l.s.r@web.de; bh=0JBadRETp0f2PdANyT2QV2l1FQoMvC5G0Xk9YAVzqGk=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=NzJCEb7p7AUYeKhqilRpdS6376WwZHY889BCYuOxHrkMshlNHL9p7wN2Og5psyOAW 7VOnTgsxKpGd3zldEqElGT2s7dWgUVyr+QiQwzfD+1ivp8fjNpzI0Sk9Gbepk0hGHc opx12SXHPAgSQMWqvcvF5/9DqGXeMLxCjaBWYynkHoAGzyENJyX9KLHEcwO+5Snm0D TUazE8v5k402bQg/KFMHZLqbkQ0X4lrreHY9pqPw2dycz9JN0Ap1HfGBQlvTiv/RCF qs2+XEYqSs2mpiY3ZUCvBFram02VFHE7GLkGorhrxdLChriIt09aW+CciaGuc6d3lh 4IG6Ni8nDnitQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([79.203.31.43]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mx0Mr-1qSBTu2wvr-00yLdP; Sat, 18 Mar 2023 22:30:25 +0100 Message-ID: <9e215e5c-0b67-0362-fd53-8c22b8d348ff@web.de> Date: Sat, 18 Mar 2023 22:30:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Bug in git archive + .gitattributes + relative path To: Junio C Hamano Cc: Cristian Le , git@vger.kernel.org, =?UTF-8?Q?Matthias_G=c3=b6rgens?= References: <42f13cda-9de6-bfc6-7e81-64c94f5640db@mpsd.mpg.de> <8d04019d-511f-0f99-42cc-d0b25720cd71@mpsd.mpg.de> <70f10864-2cc7-cb9e-f868-2ac0011cad58@web.de> <3da35216-ca42-9759-d4f9-20451a44c231@web.de> Content-Language: en-US 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:Ey+yu52gcpERtuk3xgMu+YSfj37ExN1aYFvVslD0ClGV7uyxJzY Ckq3GXrzWSXUfHh9N7SgJ7MXDpqQNY5Xd+VpoDwFYvqBAJps8imyOZirQ1ksOU6vS4g1WCL uWEIRREu7vPh1+6AqZ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6b/6Va2L886OGO7SMHO yt66QeuQHLNG6X0jQKJa3HHhlZw= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 12.03.23 um 22:25 schrieb Junio C Hamano: > Ren=C3=A9 Scharfe writes: > >>> * fail loudly when "git -C sub archive " makes us use >>> "../" prefix because goes above the $PWD for backward >>> compatibility and sanity. >> >> Without the patch this fails, but are there really people that depend o= n >> it failing? We could certainly forbid it, but do we need to? > > I dunno. It was an obvious way to avoid having to think about > interaction with --strip-components and "../", but there certainly > may be other solutions for it people can think of. > > Also on the receiving end, don't people get upset to see that their > "tar xf" escapes the directory they just created only to extract the > tarball? bsdtar creates entries starting with "../" without complaint, but refuses to extract them as-is -- you need to e.g. use --strip-components to get rid of those dots. Awkward. Not allowing those entries to be created is more consistent, especially since we're already restrictive like that. OK. >>> * with --some-option, make "git -C sub archive --some-option :/" >>> act exactly like "git archive :/". >> >> Perhaps I'm reading this too literally, but it would be easier to remov= e >> "-C sub" from that command. Or to add "-C $(git rev-parse --show-cdup)"= . >> We could add a shortcut for that (see patch below). > > More like > > $ cd some/deep/place > ... work work work > $ git archive --full-tree :/other :/hier :/archy > > is what I had in mind. Without --full-tree, due to the first bullet > point above, paths in our archive are relative to some/deep/place. I don't see the difference. Here ":/other" is the youngest commit with "other" in its message, ":/hier" and ":/archy" are pathspecs selecting subdirectories. If we stay in a different subdirectory then this is simply currently forbidden and we'd keep it like that: $ cd xdiff $ git archive :/needle :/t/t0019 :/t/t4020 | tar tf - fatal: pathspec ':/t/t0019' did not match any files We'd just improve the message a bit. Going up still helps: $ git -C "$(git rev-parse --show-cdup)" archive :/needle :/t/t0019 :/t/= t4020 | tar tf - t/ t/t0019/ t/t0019/parse_json.perl t/t4020/ t/t4020/diff.NUL # We could shorten that. $ ../git --cdup archive :/needle :/t/t0019 :/t/t4020 | tar tf - t/ t/t0019/ t/t0019/parse_json.perl t/t4020/ t/t4020/diff.NUL Or am I missing something here? Ren=C3=A9