aboutsummaryrefslogtreecommitdiff
path: root/Utility/InodeCache.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-29 15:41:09 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-29 15:41:09 -0400
commitbc22a44b2d8ea4edd4e830604acde9de8deb204b (patch)
tree9da82a7f657ba8873de4f8b0f8b4592b34011769 /Utility/InodeCache.hs
parentc40dad95d5ff114f15db9779fdbff455b913a9d5 (diff)
automatic conflict resolution for v6 unlocked files
Several tricky parts: * When the conflict is just between the same key being locked and unlocked, the unlocked version wins, and the file is not renamed in this case. * Need to update associated file map when conflict resolution renames an unlocked file. * git merge runs the smudge filter on the conflicting file, and actually overwrites the file with the same content it had before, and so invalidates its inode cache. This makes it difficult to know when it's safe to remove such files as conflict cruft, without going so far as to compare their entire contents. Dealt with this by preventing the smudge filter from populating the file when a merge is run. However, that also prevents the smudge filter being run for non-conflicting files, so eg moving a file won't put its new content into place. * Ideally, if a merge or a merge conflict resolution renames an unlocked file, the file in the work tree can just be moved, rather than copying the content to a new worktree file. This is attempted to be done in merge conflict resolution, but due to git merge's behavior of running smudge filters, what actually seems to happen is the old worktree file with the content is deleted and rewritten as a pointer file, so doesn't get reused. So, this is probably not as efficient as it optimally could be. If that becomes a problem, could look into running the merge in a separate worktree and updating the real worktree more efficiently, similarly to the direct mode merge. However, the direct mode merge had a lot of bugs, and I'd rather not use that more error-prone method unless really needed.
Diffstat (limited to 'Utility/InodeCache.hs')
-rw-r--r--Utility/InodeCache.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs
index 8bd7ae0cd..e91771a07 100644
--- a/Utility/InodeCache.hs
+++ b/Utility/InodeCache.hs
@@ -54,7 +54,7 @@ newtype InodeCache = InodeCache InodeCachePrim
{- Inode caches can be compared in two different ways, either weakly
- or strongly. -}
data InodeComparisonType = Weakly | Strongly
- deriving (Eq, Ord)
+ deriving (Eq, Ord, Show)
{- Strong comparison, including inodes. -}
compareStrong :: InodeCache -> InodeCache -> Bool
@@ -81,7 +81,7 @@ compareBy Weakly = compareWeak
{- For use in a Map; it's determined at creation time whether this
- uses strong or weak comparison for Eq. -}
data InodeCacheKey = InodeCacheKey InodeComparisonType InodeCachePrim
- deriving (Ord)
+ deriving (Ord, Show)
instance Eq InodeCacheKey where
(InodeCacheKey ctx x) == (InodeCacheKey cty y) =