On Mon, 28 Nov 2005, Linus Torvalds wrote: > On Mon, 28 Nov 2005, Daniel Barkalow wrote: > > > > I was planning to keep it in .git (instead of .git/refs/...), because it's > > information about the working tree, not properly part of the repository. > > It's like MERGE_HEAD in being about what the user is in the middle of. > > That's fine. > > However, your patch isn't. > > Your patch just creates this eternal confusion of "why is HEAD different > from CHECKED_OUT". > > It's really easy to do what you want to do _without_ any tool changes: > > git-rev-parse HEAD > .git/CHECKED_OUT > rm .git/HEAD > ln -s refs/heads/../../CHECKED_OUT .git/HEAD > > and you're done. No tool changes necessary. > > Now "HEAD" always points to the checked-out thing, but a "git clone" won't > ever actually clone your CHECKED_OUT branch. But CHECKED_OUT isn't a branch. The whole point of it is that you stay on some real branch, so you can actually use the tools to affect the repository (i.e., the things under refs/). The reason to keep CHECKED_OUT is so that you can tell if the branch you're on changes out from under you. For example, I want to have a repository where I push into the "production" branch, and I want to be able to get these changes in the working tree that the repository is in. If I have HEAD point to refs/heads/production, git doesn't know any more what's in the working tree, so it can't do the two-way merge. If I have HEAD point to CHECKED_OUT, git doesn't know any more what I want to get, so it can't do the two-way merge. That is, what I want to have work is: server$ git checkout production work$ git push server:production server$ git checkout and this should leave the working tree on server with the changes pushed from work. Currently, I have to make sure server *isn't* tracking the branch I care about when the push happens, so that it doesn't lose track of its state, and then switch to the branch to get the changes, and copy the branch to a new branch, and switch to that so the next branch won't mess up the state. HEAD is a symbolic ref to the ref in the repository that is the current branch. CHECKED_OUT is a ref to the hash that's in the working tree. Usually they match, because usually nothing is changing current branch without changing the working tree (or making the current branch match changes in the working tree), but the point of the patch is to respond sensibly to cases where this stops being true, because those can actually be part of desirable usage patterns. -Daniel *This .sig left intentionally blank* - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Tue Nov 29 17:02:12 2005
This archive was generated by hypermail 2.1.8 : 2005-11-29 17:02:17 EST