diff --git a/CHANGELOG b/CHANGELOG index 850d88ff4a..14048bc396 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,8 @@ git-annex (8.20210622) UNRELEASED; urgency=medium * Fixed bug that interrupting git-annex repair (or assistant) while it was fixing repository corruption would lose objects that were contained in pack files. + * repair: Fix reversion in version 8.20200522 that prevented fetching + missing objects from remotes. -- Joey Hess Mon, 21 Jun 2021 12:25:25 -0400 diff --git a/Git/Repair.hs b/Git/Repair.hs index d52d70ba07..df5608a014 100644 --- a/Git/Repair.hs +++ b/Git/Repair.hs @@ -42,6 +42,7 @@ import Utility.Directory.Create import Utility.Tmp.Dir import Utility.Rsync import Utility.FileMode +import Utility.CopyFile import qualified Utility.RawFilePath as R import qualified Data.Set as S @@ -115,7 +116,12 @@ retrieveMissingObjects missing referencerepo r | otherwise = withTmpDir "tmprepo" $ \tmpdir -> do unlessM (boolSystem "git" [Param "init", File tmpdir]) $ error $ "failed to create temp repository in " ++ tmpdir + let repoconfig r' = fromRawFilePath (localGitDir r' P. "config") tmpr <- Config.read =<< Construct.fromPath (toRawFilePath tmpdir) + whenM (doesFileExist (repoconfig r)) $ + void $ copyFileExternal CopyAllMetaData + (repoconfig r) + (repoconfig tmpr) rs <- Construct.fromRemotes r stillmissing <- pullremotes tmpr rs fetchrefstags missing if S.null (knownMissing stillmissing)