diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-05 17:22:19 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-05 17:22:19 -0400 |
commit | 903241502a6ad1a4845ac2d131ef7fc2b547400d (patch) | |
tree | fba85c9751a19aa0873e0f2bd837a1b000588508 /Command/Lock.hs | |
parent | cf911557bf4bb27768c4fc5ac482e8f827807497 (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/Lock.hs')
-rw-r--r-- | Command/Lock.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Command/Lock.hs b/Command/Lock.hs index e4039dd8b..8b36e1cee 100644 --- a/Command/Lock.hs +++ b/Command/Lock.hs @@ -21,6 +21,7 @@ import Utility.InodeCache import qualified Database.Keys import Annex.Ingest import Logs.Location +import Git.FilePath cmd :: Command cmd = notDirect $ withGlobalOptions annexedMatchingOptions $ @@ -85,7 +86,9 @@ performNew file key filemodified = do -- Try to repopulate obj from an unmodified associated file. repopulate obj | filemodified = modifyContent obj $ do - fs <- Database.Keys.getAssociatedFiles key + g <- Annex.gitRepo + fs <- mapM (`fromTopFilePath` g) + <$> Database.Keys.getAssociatedFiles key mfile <- firstM (isUnmodified key) fs liftIO $ nukeFile obj case mfile of @@ -99,7 +102,7 @@ performNew file key filemodified = do cleanupNew :: FilePath -> Key -> CommandCleanup cleanupNew file key = do - Database.Keys.removeAssociatedFile key file + Database.Keys.removeAssociatedFile key =<< inRepo (toTopFilePath file) return True startOld :: FilePath -> CommandStart |