{"thread":{"id":"29786","subject":"git archive invocation using sha1 to specify commit","startedAt":"2012-02-29T07:45:55Z","lastAt":"2012-02-29T08:53:06Z","messageCount":3,"participants":["Zdenek Crha","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"185704","messageId":"CA+OUE96-mLc0RJZz0g0oBWxdZKeCMQ9xJbg6DjCacN119TFY+A@mail.gmail.com","threadId":"29786","inReplyTo":null,"subject":"git archive invocation using sha1 to specify commit","fromName":"Zdenek Crha","fromEmail":"zdenek.crha@gmail.com","sentAt":"2012-02-29T07:45:55Z","receivedAt":"2012-02-29T07:45:55Z","isPatch":false,"sender":{"key":"zdenek.crha@gmail.com","avatar":null},"body":"CC me on answers please, since I'm not subscribed to the list\n\nHello,\n\nI would like to ask a question about commit restriction added to git\narchive by commit (ee27ca4a: archive: don't let remote clients get\nunreachable commits, 2011-11-17) and following efforts to loosen them\na bit.\n\nIn out company we are using git together with source indexing. We\nstore a git command for retrieval of source code file that was used\nfor building into pdb file(s). Currently, we are using an invocation\nof git archive with --remote parameter and commit sha1 to export\nexactly the source code that was used for build.\n\nThe above mentioned commit removed possibility to do that. I have read\nabout efforts to loosen the restrictions,\nbut I'm not sure whenever ability to export arbitrary sha1 will be\nallowed too. Can anybody clarify that for me please?\n\nRegards,\nZdenek Crha\n"},{"id":"185710","messageId":"7v7gz6uiv0.fsf@alter.siamese.dyndns.org","threadId":"29786","inReplyTo":"CA+OUE96-mLc0RJZz0g0oBWxdZKeCMQ9xJbg6DjCacN119TFY+A@mail.gmail.com","subject":"Re: git archive invocation using sha1 to specify commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T08:46:59Z","receivedAt":"2012-02-29T08:46:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zdenek Crha <zdenek.crha@gmail.com> writes:\n\n> In out company we are using git together with source indexing. We\n> store a git command for retrieval of source code file that was used\n> for building into pdb file(s). Currently,...\n> ... I'm not sure whenever ability to export arbitrary sha1 will be\n> allowed too.\n\nNo, that will be a premium feature that your company _could_ pay for with\nthe source of that \"source indexing\" system ;-)\n\nJokes aside, this was part of a security tightening to make sure nobody\ncould reach something that cannot be obtained by cloning, without incurring\nlarge computation overhead.\n\nTheoretically we could selectively loosen the restriction [*1*], but it is\nnot very high on our priority list.\n\n\n[Footnote]\n\n*1* When the given starting point is a raw SHA-1, we could run a single\nmerge_bases_many() to see if any of the refs can reach it, and only serve\nthe tree the check passes, or something.\n"},{"id":"185712","messageId":"20120229085306.GD14181@sigill.intra.peff.net","threadId":"29786","inReplyTo":"CA+OUE96-mLc0RJZz0g0oBWxdZKeCMQ9xJbg6DjCacN119TFY+A@mail.gmail.com","subject":"Re: git archive invocation using sha1 to specify commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-02-29T08:53:06Z","receivedAt":"2012-02-29T08:53:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 29, 2012 at 08:45:55AM +0100, Zdenek Crha wrote:\n\n> I would like to ask a question about commit restriction added to git\n> archive by commit (ee27ca4a: archive: don't let remote clients get\n> unreachable commits, 2011-11-17) and following efforts to loosen them\n> a bit.\n> \n> In out company we are using git together with source indexing. We\n> store a git command for retrieval of source code file that was used\n> for building into pdb file(s). Currently, we are using an invocation\n> of git archive with --remote parameter and commit sha1 to export\n> exactly the source code that was used for build.\n> \n> The above mentioned commit removed possibility to do that. I have read\n> about efforts to loosen the restrictions,\n> but I'm not sure whenever ability to export arbitrary sha1 will be\n> allowed too. Can anybody clarify that for me please?\n\nThe plans for loosening are still up in the air, as we didn't have real\ndata on whether people were using this feature or not. I do have patches\nready that loosen the restriction based on the details of the name\nlookup, which would allow things which started a traversal from a ref,\nlike \"foo~5\". But it would explicitly not allow an arbitrary sha1.\n\nThe only way to correctly handle an arbitrary sha1 is to actually do a\nreachability analysis from the refs. That's what we do with upload-pack\n(which handles regular fetch and clone requests). However, handling the\ngeneral case of fetching an arbitrary tree would mean we would have to\nlook inside every commit to see if it contains the tree. And that can\nget a bit expensive. It sounds like you are just asking for a commit\nsha1, so for your case we could get away with just handling sha1s of\ncommits, and only allowing trees that are referenced by commit (e.g.,\n\"HEAD~5:subdir\") or have an exact ref pointing to them (e.g., like the\nlinux v2.6.11-tree tag).\n\nYet another option would be to add a config option on the server repo to\nturn off this safety check for git-archive. That is simple to do, and\nsounds like it would handle your use case, as you control the repo. One\ndownside is that it is the server admin who must turn on the config\noption, whereas it is the clients of the repo who might want to make the\nbare-sha1 request. In a company, the admins (usually) have to listen to\nthe clients, but that is not always the case.\n\n-Peff\n"}]}