Support working trees set up by git-worktree.
Support working trees set up by git-worktree, by setting up some symlinks such that git-annex links work right. Also improved support for repositories created with --separate-git-dir. At least recent git makes a .git file for those (older may have used a symlink?), so that also needs to be converted to a symlink. This commit was sponsored by Nick Piper on Patreon.
This commit is contained in:
parent
ac5680f6f5
commit
081f8e57c6
4 changed files with 81 additions and 18 deletions
|
@ -207,10 +207,19 @@ checkForRepo dir =
|
|||
( return $ Just $ LocalUnknown dir
|
||||
, return Nothing
|
||||
)
|
||||
isRepo = checkdir $ gitSignature $ ".git" </> "config"
|
||||
isRepo = checkdir $
|
||||
gitSignature (".git" </> "config")
|
||||
<||>
|
||||
-- A git-worktree lacks .git/config, but has .git/commondir.
|
||||
-- (Normally the .git is a file, not a symlink, but it can
|
||||
-- be converted to a symlink and git will still work;
|
||||
-- this handles that case.)
|
||||
gitSignature (".git" </> "gitdir")
|
||||
isBareRepo = checkdir $ gitSignature "config"
|
||||
<&&> doesDirectoryExist (dir </> "objects")
|
||||
gitDirFile = do
|
||||
-- git-submodule, git-worktree, and --separate-git-dir
|
||||
-- make .git be a file pointing to the real git directory.
|
||||
c <- firstLine <$>
|
||||
catchDefaultIO "" (readFile $ dir </> ".git")
|
||||
return $ if gitdirprefix `isPrefixOf` c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue