Re: [RFC] Make grafts versionable
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Nov 21, 2005, 21:35 UTC
- Message-ID
- <Pine.LNX.4.64.0511211326110.13959@g5.osdl.org>
- In-Reply-To
- <43823654.2060904@zytor.com>
On Mon, 21 Nov 2005, H. Peter Anvin wrote:
> > Now, CVS has a reserved namespace (CVSROOT/) for things under version control > which are still significant to CVS. The logical equivalent to git would be to > have .git/ be such a namespace, if it makes sense.
Well, there's two reasons for disallowing git from tracking it's own .git directory:
- it protects against people doing somethin glike
git-update-cache --add -- $(find . -type f | cut -c3..)
and finding the pre-existing files in ".git"
This used to literally be how I imported trees into git. These days, you can just do it with "git-ls-files --others", and in fact that is exactly what "git add" does, so now you can just do
git add .
and be done with it - without getting that ".git" directory by mistake.
So that _old_ reason may not be as valid any more.
However, there's one fundamental reason:
- if you have a file in ".git", that implies that even a "raw git repo" would have versions matter, since technically such a file would be inside the "raw" part. And that I find to be confusing. One of the whole points of a raw git repo is that because it doesn't have anything that is version-controlled and checked out, none of the branches or tags are special, and nothing needs to be updated when you push to such a repo.
Now, if you have files in .git, suddenly that fundamental nature of a raw repository is no longer clear.
In general, making any internal git data versionable is very confusing. So you make the grafts file versionable - that suddenly means that different branches may have different parents for the same commit. And that depending on which branch you have checked out, git-fsck-cache may result in an error, or it may not. That's _nasty_, in my opinion.
So I much prefer to say: everything under ".git" is not versionable, for the fundamental reason that the files under .git are "global" to that git repository.
And I think .git/grafts in particular makes no sense to version.
If you want to track a git "grafts" file, you can do it as another git repository and a symlink.
Linus