summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-05-16 14:35:37 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-05-16 14:35:37 -0400
commit2e77647c6da30b15bcbb37c64f934fbd1a1efdf8 (patch)
tree9eb2daafe2b52c33e0f776fa3331c92434f802bd
parent4c816e4f7df10c031320a73246764d8303c64d3e (diff)
Work around bug in git 2.13.0 involving GIT_COMMON_DIR that broke merging changes into adjusted branches.
Might want to remove this when it gets fixed, in case adjusted branches are used in a repo with a great many refs, which would become unnecessarily slow. This commit was supported by the NSF-funded DataLad project.
-rw-r--r--Annex/AdjustedBranch.hs15
-rw-r--r--CHANGELOG2
2 files changed, 17 insertions, 0 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 72c07a5bc..43677d779 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -51,6 +51,7 @@ import Annex.Content
import Annex.Perms
import Annex.GitOverlay
import Utility.Tmp
+import Utility.CopyFile
import qualified Database.Keys
import Config
@@ -355,9 +356,23 @@ updateAdjustedBranch tomerge (origbranch, adj) mergeconfig commitmode = catchBoo
misctmpdir <- fromRepo gitAnnexTmpMiscDir
void $ createAnnexDirectory misctmpdir
tmpwt <- fromRepo gitAnnexMergeDir
+ git_dir <- fromRepo Git.localGitDir
withTmpDirIn misctmpdir "git" $ \tmpgit -> withWorkTreeRelated tmpgit $
withemptydir tmpwt $ withWorkTree tmpwt $ do
liftIO $ writeFile (tmpgit </> "HEAD") (fromRef updatedorig)
+ -- Copy in refs and packed-refs, to work
+ -- around bug in git 2.13.0, which
+ -- causes it not to look in GIT_DIR for refs.
+ refs <- liftIO $ dirContentsRecursive $
+ git_dir </> "refs"
+ let refs' = (git_dir </> "packed-refs") : refs
+ liftIO $ forM_ refs' $ \src ->
+ whenM (doesFileExist src) $ do
+ dest <- relPathDirToFile git_dir src
+ print (src, dest)
+ let dest' = tmpgit </> dest
+ createDirectoryIfMissing True (takeDirectory dest')
+ void $ createLinkOrCopy src dest'
-- This reset makes git merge not care
-- that the work tree is empty; otherwise
-- it will think that all the files have
diff --git a/CHANGELOG b/CHANGELOG
index 972d2f27b..3096b8020 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,8 @@ git-annex (6.20170511) UNRELEASED; urgency=medium
only one ssh password prompt will be made at a time.
* Removed dependency on MissingH, instead depending on the split library.
* Progress is displayed for transfers of files of unknown size.
+ * Work around bug in git 2.13.0 involving GIT_COMMON_DIR that broke
+ merging changes into adjusted branches.
-- Joey Hess <id@joeyh.name> Thu, 11 May 2017 15:16:23 -0400