aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-13 14:55:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-13 14:55:55 -0400
commit8c04e2d27186584e34ea76ff48f4859623654c23 (patch)
treeb3b9833e00ac212e0ee4083dafc852b38de9e5b5
parentd8f1761b54ef430560d7e8debf10e7310dfd158b (diff)
sync: Don't fail if the directory it is run in gets removed by the sync.
-rw-r--r--Command/Merge.hs3
-rw-r--r--Command/Sync.hs6
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/git-annex_sync_may_fail_when_the_directory_I__39__m_in_disepeared.mdwn1
4 files changed, 11 insertions, 1 deletions
diff --git a/Command/Merge.hs b/Command/Merge.hs
index 659f14080..5d6b2ffd2 100644
--- a/Command/Merge.hs
+++ b/Command/Merge.hs
@@ -11,7 +11,7 @@ import Common.Annex
import Command
import qualified Annex.Branch
import qualified Git.Branch
-import Command.Sync (mergeLocal)
+import Command.Sync (prepMerge, mergeLocal)
def :: [Command]
def = [command "merge" paramNothing seek SectionMaintenance
@@ -35,4 +35,5 @@ mergeBranch = do
mergeSynced :: CommandStart
mergeSynced = do
branch <- inRepo Git.Branch.current
+ prepMerge
maybe stop mergeLocal branch
diff --git a/Command/Sync.hs b/Command/Sync.hs
index e7da229a0..ca823c736 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -39,6 +39,7 @@ def = [command "sync" (paramOptional (paramRepeating paramRemote))
-- syncing involves several operations, any of which can independently fail
seek :: CommandSeek
seek rs = do
+ prepMerge
branch <- fromMaybe nobranch <$> inRepo Git.Branch.current
remotes <- syncRemotes rs
return $ concat
@@ -52,6 +53,11 @@ seek rs = do
where
nobranch = error "no branch is checked out"
+{- Merging may delete the current directory, so go to the top
+ - of the repo. -}
+prepMerge :: Annex ()
+prepMerge = liftIO . setCurrentDirectory =<< fromRepo Git.repoPath
+
syncBranch :: Git.Ref -> Git.Ref
syncBranch = Git.Ref.under "refs/heads/synced/"
diff --git a/debian/changelog b/debian/changelog
index 8a92e7042..7dfba5549 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ git-annex (4.20130912) UNRELEASED; urgency=low
wrongly represented as standin symlinks on crippled filesystems.
* sync: Fix bug that caused direct mode mappings to not be updated
when merging files into the tree on Windows.
+ * sync: Don't fail if the directory it is run in gets removed by the
+ sync.
-- Joey Hess <joeyh@debian.org> Thu, 12 Sep 2013 12:14:46 -0400
diff --git a/doc/bugs/git-annex_sync_may_fail_when_the_directory_I__39__m_in_disepeared.mdwn b/doc/bugs/git-annex_sync_may_fail_when_the_directory_I__39__m_in_disepeared.mdwn
index fe50125ee..7a2690be2 100644
--- a/doc/bugs/git-annex_sync_may_fail_when_the_directory_I__39__m_in_disepeared.mdwn
+++ b/doc/bugs/git-annex_sync_may_fail_when_the_directory_I__39__m_in_disepeared.mdwn
@@ -12,3 +12,4 @@ upgrade supported from repository versions: 0 1 2
on Debian Gnu Linux sid
+> [[fixed|done]] --[[Joey]]