more worktree improvements

Avoid more expensive code path when no core.worktree is configured.

Don't change worktree when reading config if one is already set.
This could happen if GIT_CORE_WORKTREE is set, and the repo also has
core.worktree, and the config is reread. Now GIT_CORE_WORKTREE will
prevail.
This commit is contained in:
Joey Hess 2012-05-19 10:51:22 -04:00
parent 9d98144776
commit ebbd24e5ed
2 changed files with 15 additions and 13 deletions

View file

@ -31,7 +31,7 @@ get :: IO Repo
get = do
gd <- pathenv "GIT_DIR"
r <- configure gd =<< maybe fromCwd fromPath gd
wt <- maybe (worktree $ location r) Just <$> pathenv "GIT_WORK_TREE"
wt <- maybe (Git.Config.workTree r) Just <$> pathenv "GIT_WORK_TREE"
case wt of
Nothing -> return r
Just d -> do