diff options
author | 2015-09-09 13:56:37 -0400 | |
---|---|---|
committer | 2015-09-09 13:56:37 -0400 | |
commit | cb5d06293232e6bf3902b13d98a438265127b4c8 (patch) | |
tree | 3056430f42969b21e9f5f62cf1df16f50550225f /Annex/Init.hs | |
parent | 7a6e08729168e5d3755112c6649c7e88590d12eb (diff) |
init: Fix reversion in detection of repo made with git clone --shared
Diffstat (limited to 'Annex/Init.hs')
-rw-r--r-- | Annex/Init.hs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs index e59f04572..26502511e 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -58,12 +58,18 @@ genDescription Nothing = do initialize :: Maybe String -> Annex () initialize mdescription = do + {- Has to come before any commits are made as the shared + - clone heuristic expects no local objects. -} + sharedclone <- checkSharedClone + {- This will make the first commit to git, so ensure git is set up - properly to allow commits when running it. -} ensureCommit $ Annex.Branch.create prepUUID initialize' + + initSharedClone sharedclone u <- getUUID describeUUID u =<< genDescription mdescription @@ -87,7 +93,6 @@ initialize' = do switchHEADBack ) createInodeSentinalFile - checkSharedClone uninitialize :: Annex () uninitialize = do @@ -198,8 +203,12 @@ enableDirectMode = unlessM isDirect $ do maybe noop (`toDirect` f) =<< isAnnexLink f void $ liftIO clean -checkSharedClone :: Annex () -checkSharedClone = whenM (inRepo Git.Objects.isSharedClone) $ do +checkSharedClone :: Annex Bool +checkSharedClone = inRepo Git.Objects.isSharedClone + +initSharedClone :: Bool -> Annex () +initSharedClone False = return () +initSharedClone True = do showSideAction "Repository was cloned with --shared; setting annex.hardlink=true and making repository untrusted." u <- getUUID trustSet u UnTrusted |