summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-06 16:30:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-06 16:49:41 -0400
commitd1ce927d95fe7c331cbff3317797a60aa288738b (patch)
tree829907a023dffa26da9eb60481e2269af406b1ac /Test.hs
parent6a639f6f0880d96743310728719fc797a60b2ad8 (diff)
unused: Bug fix when a new file was added to the annex, and then removed (but not git rmed). git still has the add staged in this case, so the content should not be unused and was wrongly treated as such.
So, we need to look at both the file on disk to see if it's a annex link, and the file in the index too. lookupFile doesn't look in the index if the file is not present on disk.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Test.hs b/Test.hs
index 7918ff0c1..ba491f3d8 100644
--- a/Test.hs
+++ b/Test.hs
@@ -705,8 +705,8 @@ test_fsck_basic = intmpclonerepo $ do
git_annex "get" [f] @? "get of file failed"
Utility.FileMode.allowWrite f
writeFile f (changedcontent f)
- ifM (annexeval Config.isDirect)
- ( git_annex "fsck" [] @? "fsck failed in direct mode with changed file content"
+ ifM (annexeval Config.isDirect <||> unlockedFiles <$> getTestMode)
+ ( git_annex "fsck" [] @? "fsck failed on unlocked file with changed file content"
, not <$> git_annex "fsck" [] @? "fsck failed to fail with corrupted file content"
)
git_annex "fsck" [] @? "fsck unexpectedly failed again; previous one did not fix problem with " ++ f
@@ -828,7 +828,7 @@ test_unused = intmpclonerepoInDirect $ do
checkunused [unusedfilekey] "with renamed link deleted"
-- unused used to miss symlinks that were deleted or modified
- -- manually, but commited as such.
+ -- manually
writeFile "unusedfile" "unusedcontent"
git_annex "add" ["unusedfile"] @? "add of unusedfile failed"
boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"
@@ -837,15 +837,14 @@ test_unused = intmpclonerepoInDirect $ do
boolSystem "git" [Param "rm", Param "-qf", File "unusedfile"] @? "git rm failed"
checkunused [unusedfilekey'] "with staged link deleted"
- -- unused used to miss symlinks that were deleted or modified
- -- manually, but not staged as such.
+ -- unused used to false positive on symlinks that were
+ -- deleted or modified manually, but not staged as such
writeFile "unusedfile" "unusedcontent"
git_annex "add" ["unusedfile"] @? "add of unusedfile failed"
boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"
- unusedfilekey'' <- annexeval $ findkey "unusedfile"
- checkunused [] "with unstaged deleted link"
+ checkunused [] "with staged file"
removeFile "unusedfile"
- checkunused [unusedfilekey''] "with unstaged link deleted"
+ checkunused [] "with staged deleted file"
where
checkunused expectedkeys desc = do