aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-20 14:45:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-20 14:45:17 -0400
commit518f5b76d0aeb59f817178c1a09ec8bde7a715a3 (patch)
tree9bcead76a92b89da08bb35ac0152faaea352fe7b
parent313e2e4b3ba805d59a71cf8b7617db3602daafb4 (diff)
fsck: When run with --all or --unused, while .gitattributes annex.numcopies cannot be honored since it's operating on keys instead of files, make it honor the global numcopies setting, and the annex.numcopies git config setting.
-rw-r--r--Command/Fsck.hs21
-rw-r--r--debian/changelog4
-rw-r--r--doc/bugs/Numcopies_not_checked_when_running_with_--all.mdwn16
-rw-r--r--doc/git-annex.mdwn9
4 files changed, 40 insertions, 10 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index d58ce2826..d21f2191d 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -68,7 +68,7 @@ seek ps = do
from <- getOptionField fsckFromOption Remote.byNameWithUUID
i <- getIncremental
withKeyOptions
- (startKey i)
+ (\k -> startKey i k =<< getNumCopies)
(withFilesInGit $ whenAnnexed $ start from i)
ps
@@ -162,18 +162,19 @@ performRemote key file backend numcopies remote =
)
dummymeter _ = noop
-startKey :: Incremental -> Key -> CommandStart
-startKey inc key = case Backend.maybeLookupBackendName (Types.Key.keyBackendName key) of
- Nothing -> stop
- Just backend -> runFsck inc (key2file key) key $ performAll key backend
+startKey :: Incremental -> Key -> NumCopies -> CommandStart
+startKey inc key numcopies =
+ case Backend.maybeLookupBackendName (Types.Key.keyBackendName key) of
+ Nothing -> stop
+ Just backend -> runFsck inc (key2file key) key $
+ performKey key backend numcopies
-{- Note that numcopies cannot be checked in --all mode, since we do not
- - have associated filenames to look up in the .gitattributes file. -}
-performAll :: Key -> Backend -> Annex Bool
-performAll key backend = check
+performKey :: Key -> Backend -> NumCopies -> Annex Bool
+performKey key backend numcopies = check
[ verifyLocationLog key (key2file key)
, checkKeySize key
, checkBackend backend key Nothing
+ , checkKeyNumCopies key (key2file key) numcopies
]
check :: [Annex Bool] -> Annex Bool
@@ -357,7 +358,7 @@ checkBackendOr' bad backend key file postcheck =
, return True
)
-checkKeyNumCopies :: Key -> FilePath -> NumCopies -> Annex Bool
+checkKeyNumCopies :: Key -> String -> NumCopies -> Annex Bool
checkKeyNumCopies key file numcopies = do
(untrustedlocations, safelocations) <- trustPartition UnTrusted =<< Remote.keyLocations key
let present = NumCopies (length safelocations)
diff --git a/debian/changelog b/debian/changelog
index 6c044810e..1ad914179 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,10 @@ git-annex (5.20140211) UNRELEASED; urgency=medium
of annexed files within a view.
* Add progress display for transfers to/from external special remotes.
* unused: Fix to actually detect unused keys when in direct mode.
+ * fsck: When run with --all or --unused, while .gitattributes
+ annex.numcopies cannot be honored since it's operating on keys
+ instead of files, make it honor the global numcopies setting,
+ and the annex.numcopies git config setting.
* Windows webapp: Can set up box.com, Amazon S3, and rsync.net remotes
* Windows webapp: Can create repos on removable drives.
* Windows: Ensure HOME is set, as needed by bundled cygwin utilities.
diff --git a/doc/bugs/Numcopies_not_checked_when_running_with_--all.mdwn b/doc/bugs/Numcopies_not_checked_when_running_with_--all.mdwn
index 87063c2dd..e4a364195 100644
--- a/doc/bugs/Numcopies_not_checked_when_running_with_--all.mdwn
+++ b/doc/bugs/Numcopies_not_checked_when_running_with_--all.mdwn
@@ -22,3 +22,19 @@ Linux (Ubuntu 13.10)
# End of transcript or log.
"""]]
+
+> It's expected that --all (and --unused) make .gitattributes
+> annex.numcopies settings be ignored, because with these options git-annex
+> is operating on keys, it does not know or care what filename they're
+> associated with, and so cannot look them up in .gitattributes. I have
+> improved the documentation of .gitattributes files to mention this
+> limitation.
+>
+> I also notice that fsck --all is not checking .git/config's
+> annex.numcopies or the new global numcopies setting. It certianly makes
+> sense for those numcopies settings to be paid attention to.
+> [[fixed|done]] --[[Joey]]
+>
+> (--all is faster because it can quickly scan through .git/annex/objects
+> to find everything, rather than looking at the symlink target of every
+> file in the work tree.)
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index e7183dc87..87eeda4fd 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -1625,6 +1625,15 @@ for flac files:
Note that setting numcopies to 0 is very unsafe.
+These settings are honored by git-annex whenever it's operating on a
+matching file. However, when using --all, --unused, or --key to specify
+keys to operate on, git-annex is operating on keys and not files, so will
+not honor the settings from .gitattributes.
+
+Also note that when using views, only the toplevel .gitattributes file is
+preserved in the view, so other settings in other files won't have any
+efffect.
+
# FILES
These files are used by git-annex: