Re: tracking perms/ownership
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:30
On Thu, 23 Aug 2007, Junio C Hamano wrote:
"Josh England" [off-list ref] writes:quoted
Looking at the index struct, it already has fields in it for file mode uid and gid (woohoo!).I can see that storing textual names in gitattributes and having the root user run git so that it can chown(), would work.
Well, the nice thing is that even non-root can actually resolve merge conflicts and generally use the archive, even if non-root obviously cannot then actually set the files to those users/groups! So handling ownership outside of the actual filesystem, in a separate file that git tracks, actually allows you to do things that you couldn't otherwise sanely do. It obviously does have downsides:
But this is only about checkout. After you chown a file in the work tree and run update-index, next write-tree would not record it, as there is no place in tree objects to record uid/gid.
This is a direct consequence of allowing non-root to actually work with such a repository: the git-tracked ownership information simply is separate, and "git update-index" and friends will never do anything about it, since they just can't rely on the *filesystem* user/group information anyway (because normal users would never be allowed to set it, anyway). Linus