git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG?] git-archive ignores remote .gitattributes (was: .git/info/attributes not cloned)

From
TCToby Corkindale <toby.corkindale@rea-group.com>
Date
Mar 28, 2008, 05:10 UTC
Message-ID
<47EC7DD1.3060102@rea-group.com>
In-Reply-To
<20080327045342.GC6426@coredump.intra.peff.net>
Jeff King wrote:
Show 13 quoted lines
> On Thu, Mar 27, 2008 at 03:48:31PM +1100, Toby Corkindale wrote:
> 
>>> I vaguely recall some discussion of this in the past, so maybe it isn't
>>> a good idea. But I would think changing git-archive to respect
>>> .gitattributes might be worth doing (presumably the version of
>>> .gitattributes from the tree that is being exported).
>> Respecting the repo's .gitattributes would feel right. It seems unusual  
>> (to me) that it bypasses $REMOTE/.gitattributes, but DOES check  
>> $REMOTE/info/attributes.
> 
> I agree that it seems like a bug. You might search the list archives for
> discussion around the export_subst attribute to see if it was discussed
> then or if it is simply an omission.

My searches haven't turned anything up that seems relevant. I submit that this is a bug, or at least undesirable behaviour:

"git-archive --remote=/some/repo" will ignore /some/repo/.gitattributes, but check /some/repo/info/attributes.

I think the problem is in the loop that looks for .gitattributes, which seems to do so by taking the current path and iterating down through it? In the case of remote archives, shouldn't that start by taking the path of the repo, not current dir?

Or should it go one step further, and check the .gitattributes for every file it extracts? That is the behaviour you get if you run git-archive from within a repo, rather than remotely - and don't we want that to be consistent with using --remote?

ie. I'm thinking of structures like: /myModule/testfile.pm /myModule/subdir/testfile.pm /myModule/subdir/.gitattributes

if I do "cd /myModule; git-archive HEAD" then shouldn't I get the same output as if I did "cd /tmp; git-archive --remote=/myModule HEAD" ?

Previous: Jeff KingNext: Johannes Schindelin
Message 7 of 13 in “.git/info/attributes not cloned”
  1. Toby CorkindaleMar 27, 2008
  2. Jeff KingMar 27, 2008
  3. Toby CorkindaleMar 27, 2008
  4. Jeff KingMar 27, 2008
  5. Toby CorkindaleMar 27, 2008
  6. Jeff KingMar 27, 2008
  7. [BUG?] git-archive ignores remote .gitattributes (was: .git/info/attributes not cloned)Toby Corkindale, Mar 28, 2008
  8. Johannes SchindelinMar 28, 2008
  9. Jakub NarebskiMar 28, 2008
  10. Johannes SchindelinMar 28, 2008
  11. Jeff KingMar 31, 2008
  12. Junio C HamanoMar 31, 2008
  13. Toby CorkindaleApr 10, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.