On Nov 12, 2007 7:31 PM, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote: > Hi, > > On Mon, 12 Nov 2007, Nguyen Thai Ngoc Duy wrote: > > > On Nov 12, 2007 6:57 PM, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote: > > > > > But what about setup_git_directory_gently()? If the working tree is > > > overridden by the config, this function is still bogus, right? > > > > Hmm.. thinking a little bit more. I guess you're right because > > GIT_WORK_TREE takes precedence over core.worktree. Maybe some more bits > > for check_repository_format_version(). Tough decision because, from the > > value of inside_work_tree, we don't know if we can safely skip > > overriding inside_work_tree. > > I was thinking about adding check_repository_format_version() and a check > for inside_work_tree < 0 with obvious handling in two places, probably as > a function: first, when we have a gitdirenv but no work_tree_env, and > second, at the end of _gently() when we found a git dir but only if > work_tree_env was not set. > > > > As far as I see, setup_git_directory_gently() only works correctly > > > when core.worktree is _not_ set, unless GIT_WORK_TREE is set (which is > > > supposed to override the config setting). Note: I treat GIT_WORK_TREE > > > the same as --work-tree, since at that time they are identical. > > > > > > Maybe the config stuff has to move into _gently()? > > > > Well, it could be a bit more complicated because you need to know > > GIT_DIR first before reading config. I'd rather not move as _gently() > > is complicated already. > > AFAICT it is not a question of complexity, but of correctness. Wouldn't > you agree that the prefix _gently() returns is wrong if we don't fix it? > > Besides, it might be needed anyway if we are serious about the version > check. This check, however, would have to be done _whenever_ we found a > git directory, not only when work_tree_env is NULL. Question time. setup_git_directory_gently() can be happy even if there is no repository. Now if we move version check into setup_..._gently and it finds git program is too old to handle the repository, what would we do? die() like in check_repository_format() or tell the caller there is no repository? -- Duy - 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