summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-05 13:44:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-05 13:44:09 -0400
commit6cade5c9d59566314fe63d30f648dde1abe33a32 (patch)
tree17e5a54a64dad37d128873b4748b35474b2a46b0 /Annex
parent95c95a78f1d9cf00b7d706691cbee40ba4f21cf8 (diff)
New annex.hardlink setting. Closes: #758593
* New annex.hardlink setting. Closes: #758593 * init: Automatically detect when a repository was cloned with --shared, and set annex.hardlink=true, as well as marking the repository as untrusted. Had to reorganize Logs.Trust a bit to avoid a cycle between it and Annex.Init.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs2
-rw-r--r--Annex/Init.hs12
2 files changed, 13 insertions, 1 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 6e5131f77..c0c79ae56 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -377,7 +377,7 @@ sendAnnex key rollback sendobject = go =<< prepSendAnnex key
)
{- Returns a file that contains an object's content,
- - and an check to run after the transfer is complete.
+ - and a check to run after the transfer is complete.
-
- In direct mode, it's possible for the file to change as it's being sent,
- and the check detects this case and returns False.
diff --git a/Annex/Init.hs b/Annex/Init.hs
index 637b130ee..2f7b66fbc 100644
--- a/Annex/Init.hs
+++ b/Annex/Init.hs
@@ -23,8 +23,11 @@ import qualified Git.LsFiles
import qualified Git.Config
import qualified Git.Construct
import qualified Git.Types as Git
+import qualified Git.Objects
import qualified Annex.Branch
import Logs.UUID
+import Logs.Trust.Basic
+import Types.TrustLevel
import Annex.Version
import Annex.UUID
import Config
@@ -70,6 +73,7 @@ initialize mdescription = do
Annex.Branch.create
describeUUID u =<< genDescription mdescription
+-- Everything except for uuid setup.
initialize' :: Annex ()
initialize' = do
checkFifoSupport
@@ -87,6 +91,7 @@ initialize' = do
switchHEADBack
)
createInodeSentinalFile
+ checkSharedClone
uninitialize :: Annex ()
uninitialize = do
@@ -242,3 +247,10 @@ checkBadBare = allM (not <$>)
where
hasPreCommitHook = inRepo $ doesFileExist . hookFile preCommitHook
hasDotGitHEAD = inRepo $ \r -> doesFileExist $ Git.localGitDir r </> "HEAD"
+
+checkSharedClone :: Annex ()
+checkSharedClone = whenM (inRepo Git.Objects.isSharedClone) $ do
+ showSideAction "Repository was cloned with --shared; setting annex.hardlink=true and making repository untrusted."
+ u <- getUUID
+ trustSet u UnTrusted
+ setConfig (annexConfig "hardlink") (Git.Config.boolConfig True)