aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-13 15:24:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-13 15:24:36 -0400
commitabebbcfd544953f3a2c9dab042368069fd2d916a (patch)
tree073e9f00bc566f76adc8446fd02539d8aea26d45
parent5fa25a812a8a03af9f6a5fdb3d06eb4d89ee06f5 (diff)
fsck improvements
-rw-r--r--Backend/File.hs14
-rw-r--r--Backend/SHA1.hs2
-rw-r--r--Backend/WORM.hs2
-rw-r--r--doc/walkthrough.mdwn26
4 files changed, 30 insertions, 14 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 9bda0d571..835177856 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -169,10 +169,18 @@ checkKey a key = do
checkKeyNumCopies :: Key -> Annex Bool
checkKeyNumCopies key = do
+ needed <- getNumCopies
remotes <- Remotes.keyPossibilities key
- numcopies <- getNumCopies
- if (length remotes < numcopies)
+ inannex <- inAnnex key
+ let present = length remotes + if inannex then 1 else 0
+ if (present < needed)
then do
- showLongNote $ "only " ++ show (length remotes) ++ " of " ++ show numcopies ++ " copies"
+ showLongNote $ note present needed
return False
else return True
+ where
+ note 0 _ = "** No known copies of the file exist!"
+ note present needed =
+ "Only " ++ show present ++ " of " ++ show needed ++
+ " copies exist. " ++
+ "Run git annex get somewhere else to back it up."
diff --git a/Backend/SHA1.hs b/Backend/SHA1.hs
index 8852e72e9..9e9000ba9 100644
--- a/Backend/SHA1.hs
+++ b/Backend/SHA1.hs
@@ -57,5 +57,5 @@ checkKeySHA1 key = do
then return True
else do
dest <- moveBad key
- showNote $ "bad file content (moved to "++dest++")"
+ showLongNote $ "Bad file content; moved to "++dest
return False
diff --git a/Backend/WORM.hs b/Backend/WORM.hs
index 21b3876b9..e53ec6de7 100644
--- a/Backend/WORM.hs
+++ b/Backend/WORM.hs
@@ -66,5 +66,5 @@ checkKeySize key = do
then return True
else do
dest <- moveBad key
- showNote $ "bad file size (moved to "++dest++")"
+ showLongNote $ "Bad file size; moved to "++dest
return False
diff --git a/doc/walkthrough.mdwn b/doc/walkthrough.mdwn
index 7effb5317..887fde48c 100644
--- a/doc/walkthrough.mdwn
+++ b/doc/walkthrough.mdwn
@@ -170,7 +170,7 @@ and this symlink is what gets committed to git in the end.
add my_cool_big_file ok
[master 64cda67] changed an annexed file
2 files changed, 2 insertions(+), 1 deletions(-)
- create mode 100644 .git-annex/SHA1:0b1d8616d0238cb9418a0e0a649bdad2e9e7faae.log
+ create mode 100644 .git-annex/WORM:1289672605:30:file.log
There is one problem with using `git commit` like this: Git wants to first
stage the entire contents of the file in its index. That can be slow for
@@ -287,20 +287,21 @@ setting is satisfied for all files, and it warns about any dangling values
in `.git/annex/objects/`.
# git annex fsck
- fsck (checking for unused data...) (checking files...) ok
+ fsck (checking for unused data...) ok
+ fsck my_cool_big_file (checksum..) ok
+ ......
-Fsck checks the entire repository for problems by default. But you can
-also specify the files to check.
-This is particularly useful if you're using sha1 and don't want to spend
-a long time checksumming everything.
+You can also specifiy the files to check. This is particularly useful if
+you're using sha1 and don't want to spend a long time checksumming everything.
# git annex fsck my_cool_big_file
+ fsck (checking for unused data...) ok
fsck my_cool_big_file (checksum..) ok
## fsck: When things go wrong
Fsck never deletes possibly bad data; instead it will be moved to
-`.git/annex/bad/` for you to review. Here is a sample of what fsck
+`.git/annex/bad/` for you to recover. Here is a sample of what fsck
might say about a badly messed up annex:
# git annex fsck
@@ -308,5 +309,12 @@ might say about a badly messed up annex:
Some annexed data is no longer pointed to by any files in the repository.
If this data is no longer needed, it can be removed using git-annex dropkey:
WORM:1289672605:3:file
- (checking files...)
-
+ failed
+ fsck my_cool_big_file (checksum..)
+ Bad file content; moved to .git/annex/bad/
+ ** No known copies of the file exist!
+ failed
+ fsck important_file
+ Only 1 of 2 copies exist. Run git annex get somewhere else to back it up.
+ failed
+ git-annex: 3 failed