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.
This commit is contained in:
Joey Hess 2016-05-17 13:29:51 -04:00
parent 27000d8af6
commit 93c03b5dd5
Failed to extract signature
4 changed files with 13 additions and 5 deletions

View file

@ -367,7 +367,7 @@ withIndex :: Annex a -> Annex a
withIndex = withIndex' False withIndex = withIndex' False
withIndex' :: Bool -> Annex a -> Annex a withIndex' :: Bool -> Annex a -> Annex a
withIndex' bootstrapping a = do withIndex' bootstrapping a = do
f <- liftIO . absPath =<< fromRepo gitAnnexIndex f <- fromRepo gitAnnexIndex
withIndexFile f $ do withIndexFile f $ do
checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
unless bootstrapping create unless bootstrapping create

View file

@ -17,9 +17,13 @@ import qualified Annex
{- Runs an action using a different git index file. -} {- Runs an action using a different git index file. -}
withIndexFile :: FilePath -> Annex a -> Annex a withIndexFile :: FilePath -> Annex a -> Annex a
withIndexFile f = withAltRepo withIndexFile f a = do
(\g -> addGitEnv g "GIT_INDEX_FILE" f) -- 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 }) (\g g' -> g' { gitEnv = gitEnv g })
a
{- Runs an action using a different git work tree. {- Runs an action using a different git work tree.
- -

View file

@ -24,7 +24,9 @@ indexEnv = "GIT_INDEX_FILE"
override :: FilePath -> IO (IO ()) override :: FilePath -> IO (IO ())
override index = do override index = do
res <- getEnv var 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 return $ reset res
where where
var = "GIT_INDEX_FILE" var = "GIT_INDEX_FILE"

2
debian/changelog vendored
View file

@ -15,6 +15,8 @@ git-annex (6.20160512) UNRELEASED; urgency=medium
thing) thing)
* adjust: Add --fix adjustment, which is useful when the git directory * adjust: Add --fix adjustment, which is useful when the git directory
is in a nonstandard place. 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 <id@joeyh.name> Wed, 11 May 2016 16:08:38 -0400 -- Joey Hess <id@joeyh.name> Wed, 11 May 2016 16:08:38 -0400