Work around git 2.50 bug that caused it to crash when there is a merge conflict with...
authorJoey Hess <joeyh@joeyh.name>
Wed, 25 Jun 2025 17:36:19 +0000 (13:36 -0400)
committerSean Whitton <spwhitton@spwhitton.name>
Tue, 1 Jul 2025 10:23:12 +0000 (11:23 +0100)
This fixes several test suite failures with git 2.50.

See the bug report for the full, gory details.

(cherry picked from commit fb155b1e3e59cc1f9cf8a4fe7d47cba49d1c81af)

Database/Keys.hs

index cc3f189b993b31b389c4c548842c461dbb8a2527..22962e13723837da312339d2615250cd1848efda 100644 (file)
@@ -1,6 +1,6 @@
 {- Sqlite database of information about Keys
  -
- - Copyright 2015-2022 Joey Hess <id@joeyh.name>
+ - Copyright 2015-2025 Joey Hess <id@joeyh.name>
  -
  - Licensed under the GNU AGPL version 3 or higher.
  -}
@@ -260,7 +260,7 @@ isInodeKnown i s = or <$> runReaderIO ContentTable
  - is an associated file.
  -}
 reconcileStaged :: Bool -> H.DbQueue -> Annex DbTablesChanged
-reconcileStaged dbisnew qh = ifM isBareRepo
+reconcileStaged dbisnew qh = ifM notneeded
        ( return mempty
        , do
                gitindex <- inRepo currentIndexFile
@@ -335,6 +335,14 @@ reconcileStaged dbisnew qh = ifM isBareRepo
        getindextree = inRepo $ \r -> writeTreeQuiet $ r
                { gitGlobalOpts = gitGlobalOpts r ++ bypassSmudgeConfig }
        
+       notneeded = isBareRepo
+               -- Avoid doing anything when run by the 
+               -- smudge clean filter. When that happens in a conflicted
+               -- merge situation, running git write-tree
+               -- here would cause git merge to fail with an internal
+               -- error. This works around around that bug in git.
+               <||> Annex.getState Annex.insmudgecleanfilter
+       
        diff old new =
                -- Avoid running smudge clean filter, since we want the
                -- raw output, and it would block trying to access the