Unused: bugfix

Detect staged files that are not in the working tree.
This commit is contained in:
guilhem 2013-08-26 19:01:48 +02:00 committed by Joey Hess
parent 88e2618e38
commit f754779c02
3 changed files with 64 additions and 17 deletions

20
Test.hs
View file

@ -598,6 +598,26 @@ test_unused env = "git-annex unused/dropunused" ~: intmpclonerepoInDirect env $
removeFile "unusedunstagedfile"
checkunused [unusedfilekey] "with unstaged link deleted"
-- unused used to miss symlinks that were deleted or modified
-- manually, but commited as such.
writeFile "unusedfile" "unusedcontent"
git_annex env "add" ["unusedfile"] @? "add of unusedfile failed"
boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"
unusedfilekey' <- annexeval $ findkey "unusedfile"
checkunused [] "with staged deleted link"
boolSystem "git" [Params "rm -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.
writeFile "unusedfile" "unusedcontent"
git_annex env "add" ["unusedfile"] @? "add of unusedfile failed"
boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"
unusedfilekey'' <- annexeval $ findkey "unusedfile"
checkunused [] "with unstaged deleted link"
removeFile "unusedfile"
checkunused [unusedfilekey''] "with unstaged link deleted"
where
checkunused expectedkeys desc = do
git_annex env "unused" [] @? "unused failed"