summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-10-10 15:00:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-10-10 15:00:45 -0400
commit661c79f7d0175a017e8f345b09ae13ebdfbf9022 (patch)
treec7c948a45773929fe3c8c8440bde6d1cf2ffd280 /Git
parentd1ff850120eabe57248f6d3b2948551ce61c26df (diff)
sync: Fix bug in adjusted branch merging that could cause recently added files to be lost when updating the adjusted branch.
The modification flag was not being set when making modifications deep in a tree, so parent trees were not updated to contain the modified tree. Seems to have exposed another bug where the wrong filename gets grafted in. This commit was sponsored by Brock Spratlen on Patreon.
Diffstat (limited to 'Git')
-rw-r--r--Git/Tree.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Git/Tree.hs b/Git/Tree.hs
index cfd5b910d..65c3d713a 100644
--- a/Git/Tree.hs
+++ b/Git/Tree.hs
@@ -184,10 +184,11 @@ adjustTree adjusttreeitem addtreeitems removefiles r repo =
Just TreeObject -> do
(sl, modified, is') <- go h False [] (beneathSubTree i) is
sl' <- adjustlist h (inTree i) (beneathSubTree i) sl
- subtree <- if modified || sl' /= sl
+ let slmodified = sl' /= sl
+ subtree <- if modified || slmodified
then liftIO $ recordSubTree h $ NewSubTree (LsTree.file i) sl'
else return $ RecordedSubTree (LsTree.file i) (LsTree.sha i) []
- let !modified' = modified || wasmodified
+ let !modified' = modified || slmodified || wasmodified
go h modified' (subtree : c) intree is'
_ -> error ("unexpected object type \"" ++ LsTree.typeobj i ++ "\"")
| otherwise = return (c, wasmodified, i:is)