From: Nguyen Thai Ngoc Duy Date: Wed, 19 Jan 2011 14:48:57 GMT Subject: Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree Message-ID: In-Reply-To: <20110119124230.GD23222@burratino> 2011/1/19 Jonathan Nieder : > @@ -411,6 +411,16 @@ static const char *setup_discovered_git_dir(const char *gitdir, >        if (check_repository_format_gently(gitdir, nongit_ok)) >                return NULL; > > +       /* Accept --work-tree to support old scripts that played with fire. */ > +       if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) { Can we leave git_work_tree_cfg out? If this code is to support misused scripts, then $GIT_WORK_TREE alone ought to be enough. I don't think any scripts would use core.worktree. Most of worktree headache comes from core.worktree, not $GIT_WORK_TREE. Granted though the situation is better now that we don't set worktree in setup_git_directory(). > +               warning("pretending GIT_DIR was supplied alongside GIT_WORK_TREE"); What if core.worktree is set, not $GIT_WORK_TREE? In my opinion > +               if (offset != len && !is_absolute_path(gitdir)) > +                       gitdir = xstrdup(make_absolute_path(gitdir)); The behavior regarding relative $GIT_WORK_TREE before nd/setup series is inconsistent. If setup_git_directory() is used, work_tree is relative to user's cwd. In other cases, when get_git_work_tree() is called, work_tree is made absolute relative to _current_ cwd (usually at discovered work_tree root). Which way do you want to keep? -- Duy