sync: Don't fail if the directory it is run in gets removed by the sync.

This commit is contained in:
Joey Hess 2013-09-13 14:55:55 -04:00
parent 928016c670
commit 2407170eaf
4 changed files with 11 additions and 1 deletions

View file

@ -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

View file

@ -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/"

2
debian/changelog vendored
View file

@ -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

View file

@ -12,3 +12,4 @@ upgrade supported from repository versions: 0 1 2
on Debian Gnu Linux sid
> [[fixed|done]] --[[Joey]]