aboutsummaryrefslogtreecommitdiff
path: root/Command/Unannex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-05 17:22:19 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-05 17:22:19 -0400
commit903241502a6ad1a4845ac2d131ef7fc2b547400d (patch)
treefba85c9751a19aa0873e0f2bd837a1b000588508 /Command/Unannex.hs
parentcf911557bf4bb27768c4fc5ac482e8f827807497 (diff)
use TopFilePath for associated files
Fixes several bugs with updates of pointer files. When eg, running git annex drop --from localremote it was updating the pointer file in the local repository, not the remote. Also, fixes drop ../foo when run in a subdir, and probably lots of other problems. Test suite drops from ~30 to 11 failures now. TopFilePath is used to force thinking about what the filepath is relative to. The data stored in the sqlite db is still just a plain string, and TopFilePath is a newtype, so there's no overhead involved in using it in DataBase.Keys.
Diffstat (limited to 'Command/Unannex.hs')
-rw-r--r--Command/Unannex.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index 9bde19106..317fd5856 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -23,6 +23,7 @@ import qualified Git.DiffTree as DiffTree
import Utility.CopyFile
import Command.PreCommit (lockPreCommitHook)
import qualified Database.Keys
+import Git.FilePath
cmd :: Command
cmd = withGlobalOptions annexedMatchingOptions $
@@ -87,7 +88,7 @@ performIndirect file key = do
cleanupIndirect :: FilePath -> Key -> CommandCleanup
cleanupIndirect file key = do
- Database.Keys.removeAssociatedFile key file
+ Database.Keys.removeAssociatedFile key =<< inRepo (toTopFilePath file)
src <- calcRepo $ gitAnnexLocation key
ifM (Annex.getState Annex.fast)
( do