summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-09 12:05:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-09 12:05:56 -0400
commitb14b041bfa448dff6a486b3e04910741732b8c0e (patch)
tree7dc01563e83a80a8ffc647fb7d0f8f3d55275ccf
parent48d561a7053fdcc42bf11cb41a0e0b73c5b70d68 (diff)
Make --numcopies override annex.numcopies set in .gitattributes.
-rw-r--r--Annex.hs2
-rw-r--r--Command.hs6
-rw-r--r--GitAnnex/Options.hs3
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/annex.numcopies_not_overriden_by_--numcopies_option.mdwn3
5 files changed, 12 insertions, 3 deletions
diff --git a/Annex.hs b/Annex.hs
index 2f0f7f5dc..e15d31e72 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -92,6 +92,7 @@ data AnnexState = AnnexState
, catfilehandles :: M.Map FilePath CatFileHandle
, checkattrhandle :: Maybe CheckAttrHandle
, forcebackend :: Maybe String
+ , forcenumcopies :: Maybe Int
, limit :: Matcher (FileInfo -> Annex Bool)
, uuidmap :: Maybe UUIDMap
, preferredcontentmap :: Maybe PreferredContentMap
@@ -123,6 +124,7 @@ newState gitrepo = AnnexState
, catfilehandles = M.empty
, checkattrhandle = Nothing
, forcebackend = Nothing
+ , forcenumcopies = Nothing
, limit = Left []
, uuidmap = Nothing
, preferredcontentmap = Nothing
diff --git a/Command.hs b/Command.hs
index 06126103b..8083e0d7c 100644
--- a/Command.hs
+++ b/Command.hs
@@ -99,7 +99,11 @@ isBareRepo :: Annex Bool
isBareRepo = fromRepo Git.repoIsLocalBare
numCopies :: FilePath -> Annex (Maybe Int)
-numCopies file = readish <$> checkAttr "annex.numcopies" file
+numCopies file = do
+ forced <- Annex.getState Annex.forcenumcopies
+ case forced of
+ Just n -> return $ Just n
+ Nothing -> readish <$> checkAttr "annex.numcopies" file
numCopiesCheck :: FilePath -> Key -> (Int -> Int -> Bool) -> Annex Bool
numCopiesCheck file key vs = do
diff --git a/GitAnnex/Options.hs b/GitAnnex/Options.hs
index e74fc0a03..2cfdfafd2 100644
--- a/GitAnnex/Options.hs
+++ b/GitAnnex/Options.hs
@@ -53,10 +53,9 @@ options = Option.common ++
] ++ Option.matcher
where
setnumcopies v = maybe noop
- (\n -> Annex.changeGitConfig $ \c -> c { annexNumCopies = n })
+ (\n -> Annex.changeState $ \s -> s { Annex.forcenumcopies = Just n })
(readish v)
setgitconfig v = Annex.changeGitRepo =<< inRepo (Git.Config.store v)
-
trustArg t = ReqArg (Remote.forceTrust t) paramRemote
keyOptions :: [Option]
diff --git a/debian/changelog b/debian/changelog
index dec7bed0a..ac5f3dadb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,7 @@ git-annex (4.20130628) UNRELEASED; urgency=low
does not correspond to any unused key.
* fsck: Don't claim to fix direct mode when run on a symlink whose content
is not present.
+ * Make --numcopies override annex.numcopies set in .gitattributes.
-- Joey Hess <joeyh@debian.org> Tue, 02 Jul 2013 15:40:55 -0400
diff --git a/doc/bugs/annex.numcopies_not_overriden_by_--numcopies_option.mdwn b/doc/bugs/annex.numcopies_not_overriden_by_--numcopies_option.mdwn
index b4d54dd31..ba63897ba 100644
--- a/doc/bugs/annex.numcopies_not_overriden_by_--numcopies_option.mdwn
+++ b/doc/bugs/annex.numcopies_not_overriden_by_--numcopies_option.mdwn
@@ -11,3 +11,6 @@ Second line fails if only one other copy exists.
### What version of git-annex are you using? On what operating system?
git-annex version: 4.20130627
+
+> I don't think this was ever handled correctly.
+> I've fixed it now. [[done]] --[[Joey]]