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 where
dotgit = w </> ".git" dotgit = w </> ".git"
replacedotgit = whenM (doesFileExist dotgit) $ do replacedotgit = whenM (doesFileExist dotgit) $ do
linktarget <- relPathDirToFile w d
nukeFile dotgit nukeFile dotgit
createSymbolicLink (w </> d) dotgit createSymbolicLink linktarget dotgit
maybe (error "unset core.worktree failed") (\_ -> return ()) maybe (error "unset core.worktree failed") (\_ -> return ())
=<< Git.Config.unset "core.worktree" r =<< Git.Config.unset "core.worktree" r
fixupSubmodule r _ = return r fixupSubmodule r _ = return r

3
debian/changelog vendored
View file

@ -19,6 +19,9 @@ git-annex (6.20160127) UNRELEASED; urgency=medium
expression. expression.
* Brought back the dbus and xmpp build flags, so build from source can be * Brought back the dbus and xmpp build flags, so build from source can be
done without C libraries that may be hard to install. done without C libraries that may be hard to install.
* init: Fix bugs in submodule .git symlink fixup, that occurred when
initializing in a subdirectory of a submodule and a submodule of a
submodule.
-- Joey Hess <id@joeyh.name> Thu, 28 Jan 2016 13:53:09 -0400 -- Joey Hess <id@joeyh.name> Thu, 28 Jan 2016 13:53:09 -0400

View file

@ -45,3 +45,5 @@ upgrade supported from repository versions: 0 1 2 4 5
"""]] """]]
[[!meta author=yoh]] [[!meta author=yoh]]
> [[fixed|done]]

View file

@ -0,0 +1,8 @@
[[!comment format=mdwn
username="joey"
subject="""comment 3"""
date="2016-02-08T18:27:32Z"
content="""
Yeah, it was running git annex init in the subdir of the submodule that
triggered the bug. Easy fix, also fixes init in submodules of submodules.
"""]]