aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:32:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:32:38 -0400
commite18a4d566b4f205c8a60ddf79ce02ba023d34984 (patch)
tree0619f017f42d5b6941051da42024431e38e39feb
parentb557a2ccf4cd634a2c276b9ae03b881814de58be (diff)
migrate: Fix support for --backend option.
-rw-r--r--Command/Migrate.hs9
-rw-r--r--debian/changelog1
-rw-r--r--test.hs4
3 files changed, 10 insertions, 4 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs
index 3d6121437..59ad36a2b 100644
--- a/Command/Migrate.hs
+++ b/Command/Migrate.hs
@@ -27,15 +27,20 @@ seek :: [CommandSeek]
seek = [withBackendFilesInGit start]
start :: CommandStartBackendFile
-start (_, Nothing) = return Nothing
-start (file, Just newbackend) = isAnnexed file $ \(key, oldbackend) -> do
+start (file, b) = isAnnexed file $ \(key, oldbackend) -> do
exists <- inAnnex key
+ newbackend <- choosebackend b
if (newbackend /= oldbackend) && exists
then do
showStart "migrate" file
return $ Just $ perform file key newbackend
else
return Nothing
+ where
+ choosebackend Nothing = do
+ backends <- Backend.list
+ return $ head backends
+ choosebackend (Just backend) = return backend
perform :: FilePath -> Key -> Backend -> CommandPerform
perform file oldkey newbackend = do
diff --git a/debian/changelog b/debian/changelog
index 6950bda20..510091b7b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ git-annex (0.18) UNRELEASED; urgency=low
after transferring the file to the remote repository.
(Did not affect ssh remotes.)
* fsck: Fix bug in moving of corrupted files to .git/annex/bad/
+ * migrate: Fix support for --backend option.
* Test suite improvements. Current top-level test coverage: 75%
-- Joey Hess <joeyh@debian.org> Tue, 11 Jan 2011 16:05:25 -0400
diff --git a/test.hs b/test.hs
index 716d1a0de..417d830e8 100644
--- a/test.hs
+++ b/test.hs
@@ -328,8 +328,8 @@ test_migrate = "git-annex migrate" ~: TestList [t False, t True]
if usegitattributes
then do
writeFile ".gitattributes" "* annex.backend=SHA1"
- git_annex "migrate" [sha1annexedfile] @? "migrate to same backend failed"
- git_annex "migrate" [annexedfile] @? "migrate to different backend failed"
+ git_annex "migrate" ["-q", sha1annexedfile] @? "migrate to same backend failed"
+ git_annex "migrate" ["-q", annexedfile] @? "migrate to different backend failed"
else do
git_annex "migrate" [sha1annexedfile, "--backend=SHA1"] @? "migrate to same backend failed"
git_annex "migrate" [annexedfile, "--backend=SHA1"] @? "migrate to different backend failed"