From bc620991aa586d6758e5ef997342899edc87bc4a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Jan 2015 17:18:12 -0400 Subject: direct mode merge relative path trickiness This fixes 9 test suite failures. There are some tricky things going on with the paths to the index file, and git's working directory, which are hard to get right with relative paths. So, I switched back to absolute here, at least for now. Only 2 test suite failures remain on this branch, but there are other potential problems the test suite doesn't catch. Including some calls to setCurrentDirectory -- I was wrong and git-annex does do that in a few places, like when generating a view. --- Annex/Direct.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Annex/Direct.hs') diff --git a/Annex/Direct.hs b/Annex/Direct.hs index e4015dd16..15eb04060 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -160,8 +160,8 @@ addDirect file cache = do -} mergeDirect :: Maybe Git.Ref -> Maybe Git.Ref -> Git.Branch -> Annex Bool -> Git.Branch.CommitMode -> Annex Bool mergeDirect startbranch oldref branch resolvemerge commitmode = exclusively $ do - reali <- fromRepo indexFile - tmpi <- fromRepo indexFileLock + reali <- liftIO . absPath =<< fromRepo indexFile + tmpi <- liftIO . absPath =<< fromRepo indexFileLock liftIO $ copyFile reali tmpi d <- fromRepo gitAnnexMergeDir @@ -198,9 +198,12 @@ stageMerge d branch commitmode = do merger <- ifM (coreSymlinks <$> Annex.getGitConfig) ( return Git.Merge.stageMerge , return $ \ref -> Git.Merge.mergeNonInteractive ref commitmode - ) - inRepo $ \g -> merger branch $ - g { location = Local { gitdir = Git.localGitDir g, worktree = Just d } } + ) + inRepo $ \g -> do + wd <- liftIO $ absPath d + gd <- liftIO $ absPath $ Git.localGitDir g + merger branch $ + g { location = Local { gitdir = gd, worktree = Just (addTrailingPathSeparator wd) } } {- Commits after a direct mode merge is complete, and after the work - tree has been updated by mergeDirectCleanup. -- cgit v1.2.3