git check-attr in bare repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]