Fix exception handling bug that could cause .git/annex/index to be used for git commits outside the git-annex branch. Known to affect git-annex when used with the git shipped with Ubuntu 13.10.
This commit is contained in:
parent
fc82197549
commit
ee23be55fd
3 changed files with 15 additions and 8 deletions
|
@ -29,6 +29,7 @@ module Annex.Branch (
|
||||||
import qualified Data.ByteString.Lazy.Char8 as L
|
import qualified Data.ByteString.Lazy.Char8 as L
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
import qualified Control.Exception as E
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import Annex.BranchState
|
import Annex.BranchState
|
||||||
|
@ -53,6 +54,7 @@ import Logs.Trust.Pure
|
||||||
import Annex.ReplaceFile
|
import Annex.ReplaceFile
|
||||||
import qualified Annex.Queue
|
import qualified Annex.Queue
|
||||||
import Annex.Branch.Transitions
|
import Annex.Branch.Transitions
|
||||||
|
import Annex.Exception
|
||||||
|
|
||||||
{- Name of the branch that is used to store git-annex's information. -}
|
{- Name of the branch that is used to store git-annex's information. -}
|
||||||
name :: Git.Ref
|
name :: Git.Ref
|
||||||
|
@ -345,15 +347,15 @@ withIndex' bootstrapping a = do
|
||||||
#endif
|
#endif
|
||||||
let g' = g { gitEnv = Just $ ("GIT_INDEX_FILE", f):e }
|
let g' = g { gitEnv = Just $ ("GIT_INDEX_FILE", f):e }
|
||||||
|
|
||||||
|
r <- tryAnnex $ do
|
||||||
Annex.changeState $ \s -> s { Annex.repo = g' }
|
Annex.changeState $ \s -> s { Annex.repo = g' }
|
||||||
checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
|
checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
|
||||||
unless bootstrapping create
|
unless bootstrapping create
|
||||||
liftIO $ createDirectoryIfMissing True $ takeDirectory f
|
liftIO $ createDirectoryIfMissing True $ takeDirectory f
|
||||||
unless bootstrapping $ inRepo genIndex
|
unless bootstrapping $ inRepo genIndex
|
||||||
r <- a
|
a
|
||||||
Annex.changeState $ \s -> s { Annex.repo = (Annex.repo s) { gitEnv = gitEnv g} }
|
Annex.changeState $ \s -> s { Annex.repo = (Annex.repo s) { gitEnv = gitEnv g} }
|
||||||
|
either Ethrow return r
|
||||||
return r
|
|
||||||
|
|
||||||
{- Updates the branch's index to reflect the current contents of the branch.
|
{- Updates the branch's index to reflect the current contents of the branch.
|
||||||
- Any changes staged in the index will be preserved.
|
- Any changes staged in the index will be preserved.
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -13,6 +13,9 @@ git-annex (4.20131106) unstable; urgency=low
|
||||||
views in the webapp.
|
views in the webapp.
|
||||||
* map: Work when there are gcrypt remotes.
|
* map: Work when there are gcrypt remotes.
|
||||||
* Fix build w/o webapp.
|
* Fix build w/o webapp.
|
||||||
|
* Fix exception handling bug that could cause .git/annex/index to be used
|
||||||
|
for git commits outside the git-annex branch. Known to affect git-annex
|
||||||
|
when used with the git shipped with Ubuntu 13.10.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 06 Nov 2013 11:17:47 -0400
|
-- Joey Hess <joeyh@debian.org> Wed, 06 Nov 2013 11:17:47 -0400
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,5 @@ Perhaps some sort of a race-condition with the annex-assistant picking up the uu
|
||||||
|
|
||||||
### What version of git-annex are you using? On what operating system?
|
### What version of git-annex are you using? On what operating system?
|
||||||
Ubuntu 13.10 with git-annex 4.20130815
|
Ubuntu 13.10 with git-annex 4.20130815
|
||||||
|
|
||||||
|
> [[fixed|done]]; see comments. (This fix needs to be backported to Ubuntu.) --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue