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

git check-attr in bare repositories

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 29, 2010, 23:15 UTC
Message-ID
<20100329231501.GA28194@progeny.tock>
In-Reply-To
<19376.53419.640007.930897@winooski.ccs.neu.edu>
Eli Barzilay wrote:
> On Mar 29, Eli Barzilay wrote:
>> On Mar 27, Jonathan Nieder wrote:
[in a bare repository]
>>>  GIT_INDEX=tmp-index git check-attr "$@" &&
[...]
>> I tried that, but it doesn't work.  (I used GIT_INDEX_FILE.)
Yes, not sure how I confused myself.
git explicitly guards against that in attr.c.
	/*
	 * Read from parent directories and push them down
	 */
	if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {

That check comes from v1.5.6-rc3~9^2 (Ignore .gitattributes in bare repositories, 2008-06-08). This is consistent with how bare repositories generally work: they are guarded against use with a populated index, since what filesystem tree would that index track?

To support your use case, it would be nice for check-attr to learn a --direction option. Maybe it would be safe to let check-attr read from the index in bare repositories by default anyway, since the index is usually missing anyway.

Properly supporting general work in a bare repository would require a larger effort. Maybe:

 - Teach code that checks is_bare_repository() to check
   get_git_work_tree() == NULL or similar instead.
 - Make the work_tree and git_dir variables the responsibility of the
   setup code.
 - If the user sets GIT_INDEX_FILE or GIT_WORK_TREE, let the setup
   code respect that wish even if core.bare is set.

Thoughts? Jonathan

Previous: Eli BarzilayNext: Eli Barzilay
Message 5 of 12 in “`git check-attr' problems & questions”
  1. Eli BarzilayMar 26, 2010
  2. Jonathan NiederMar 28, 2010
  3. Eli BarzilayMar 29, 2010
  4. Eli BarzilayMar 29, 2010
  5. git check-attr in bare repositoriesJonathan Nieder, Mar 29, 2010
  6. Eli BarzilayMar 30, 2010
  7. Jonathan NiederMar 30, 2010
  8. Jakub NarebskiMar 30, 2010
  9. Eli BarzilayMar 31, 2010
  10. Carrying over attributes when moving filesJonathan Nieder, Mar 30, 2010
  11. Eli BarzilayMar 31, 2010
  12. Junio C HamanoMar 31, 2010

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.