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

git-archive and unwanted .gitattributes

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jun 7, 2008, 15:21 UTC
Message-ID
<fcaeb9bf0806070821r5ba650c2x1fef7947fc4a2de5@mail.gmail.com>
Hi,

Currently attr.c will read .gitattributes on disk no matter there is a real worktree or not. This can lead to strange behavior. For example when I do

mkdir a && cd a git init echo '$Format:%s$' > a git add a && git commit -m initial cd .. echo 'a export-subst' > .gitattributes # let's assume this is an accident. git --git-dir=a/.git archive --format=tar HEAD|tar xO a

I expect it to show '$Format:%s$', not "initial". git-archive should not bother reading that .gitattributes. I thought an is_inside_work_tree() check would be enough. Unfortunately, setting --git-dir will automatically set worktree too. Any ideas?

-- 
Duy
Next: Jakub Narebski
Message 1 of 8 in “git-archive and unwanted .gitattributes”
  1. Nguyen Thai Ngoc DuyJun 7, 2008
  2. Jakub NarebskiJun 7, 2008
  3. Nguyen Thai Ngoc DuyJun 7, 2008
  4. René ScharfeJun 8, 2008
  5. fix attribute handling in bare repositoriesRené Scharfe, Jun 8, 2008
  6. Junio C HamanoJun 8, 2008
  7. René ScharfeJun 8, 2008
  8. Nguyen Thai Ngoc DuyJun 9, 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.