init: Fix bugs in submodule .git symlink fixup, that occurred when initializing in a subdirectory of a submodule and a submodule of a submodule.

This commit is contained in:
Joey Hess 2016-02-08 15:41:19 -04:00
parent 085ec7d693
commit 17c97434f2
Failed to extract signature
4 changed files with 15 additions and 1 deletions

View file

@ -90,8 +90,9 @@ fixupSubmodule r@(Repo { location = l@(Local { worktree = Just w, gitdir = d })
where
dotgit = w </> ".git"
replacedotgit = whenM (doesFileExist dotgit) $ do
linktarget <- relPathDirToFile w d
nukeFile dotgit
createSymbolicLink (w </> d) dotgit
createSymbolicLink linktarget dotgit
maybe (error "unset core.worktree failed") (\_ -> return ())
=<< Git.Config.unset "core.worktree" r
fixupSubmodule r _ = return r