From e2b93987143faba2c1f507da436752ef826c5ff3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 May 2016 13:29:51 -0400 Subject: Work around git bug in handling of relative path to GIT_INDEX_FILE when in a subdirectory of the repository. This affected git annex view. It turns out that some other places that use GIT_INDEX_FILE were already working around the bug. I removed the workaround from Annex.Branch since the new workaround will do. --- Annex/Branch.hs | 2 +- Annex/GitOverlay.hs | 10 +++++++--- Git/Index.hs | 4 +++- debian/changelog | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 1e5800c21..e43c07f8e 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -367,7 +367,7 @@ withIndex :: Annex a -> Annex a withIndex = withIndex' False withIndex' :: Bool -> Annex a -> Annex a withIndex' bootstrapping a = do - f <- liftIO . absPath =<< fromRepo gitAnnexIndex + f <- fromRepo gitAnnexIndex withIndexFile f $ do checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do unless bootstrapping create diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs index e33d8a83c..8cc1e04d1 100644 --- a/Annex/GitOverlay.hs +++ b/Annex/GitOverlay.hs @@ -17,9 +17,13 @@ import qualified Annex {- Runs an action using a different git index file. -} withIndexFile :: FilePath -> Annex a -> Annex a -withIndexFile f = withAltRepo - (\g -> addGitEnv g "GIT_INDEX_FILE" f) - (\g g' -> g' { gitEnv = gitEnv g }) +withIndexFile f a = do + -- Workaround http://thread.gmane.org/gmane.comp.version-control.git/294880 + absf <- liftIO $ absPath f + withAltRepo + (\g -> addGitEnv g "GIT_INDEX_FILE" absf) + (\g g' -> g' { gitEnv = gitEnv g }) + a {- Runs an action using a different git work tree. - diff --git a/Git/Index.hs b/Git/Index.hs index 551fd98d3..a8b1df396 100644 --- a/Git/Index.hs +++ b/Git/Index.hs @@ -24,7 +24,9 @@ indexEnv = "GIT_INDEX_FILE" override :: FilePath -> IO (IO ()) override index = do res <- getEnv var - setEnv var index True + -- Workaround http://thread.gmane.org/gmane.comp.version-control.git/294880 + absindex <- absPath index + setEnv var absindex True return $ reset res where var = "GIT_INDEX_FILE" diff --git a/debian/changelog b/debian/changelog index 24c110521..e60b43aa5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,8 @@ git-annex (6.20160512) UNRELEASED; urgency=medium thing) * adjust: Add --fix adjustment, which is useful when the git directory is in a nonstandard place. + * Work around git bug in handling of relative path to GIT_INDEX_FILE + when in a subdirectory of the repository. This affected git annex view. -- Joey Hess Wed, 11 May 2016 16:08:38 -0400 -- cgit v1.2.3