On the Correctness of Software Merge
Akira Mori, Masatomo Hashimoto
Abstract
Three-way merge tools play crucial roles in modern software development, where a developer forks a branch to make local modifications and requests it to be merged into the main branch via a "pull request." Despite its importance, the task has traditionally been defined in an intuitive manner, and the results of merge tools are often accepted without scrutiny. In this paper, we present a new structural merge tool in comparison with existing tools based on the syntactic criteria we propose for evaluating the merge results. We require the merge result to be both parsable and universal. Being parsable means that the result is syntactically valid according to the grammar of the programming language. Being universal means that the result incorporates all and only the edit operations occurring in each branch while ensuring that edits common to both branches are applied only once. This requirement can be precisely defined using the notion of pushouts in category theory. In a large-scale experiment involving 43,774 file merge scenarios from 76 open-source Java projects, we found a number of incorrect results reported by existing tools such as the Git companion merge tool, whereas our tool reports none. We further compared d3j’s results with 2,582 developer-resolved merges and with 2,459 merge scenarios involving 21 refactoring types. These experiments revealed both the strengths and current limitations of structural merge, and underscore the importance of clear correctness criteria. We expect that the proposed criterion will provide a foundation for developing more reliable and principled merge tools.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 92b23531-e578-4956-a06f-cff51a07ccfdRelated papers
- Do code refactorings influence the merge effort?André Oliveira, Vânia Neves, Alexandre Plastino, Ana Carla Bibiano et al.ICSE 2023 · 5 citations
- Evaluation of Version Control Merge ToolsBenedikt Schesch, Ryan Featherman, Kenneth J. Yang, Ben R. Roberts et al.ASE 2024 · 1 citation
- Semistructured Merge with Language-Specific Syntactic SeparatorsGuilherme Cavalcanti, Paulo Borba, Leonardo dos Anjos, Jônatas ClementinoASE 2024 · 1 citation
- Can Program Synthesis be Used to Learn Merge Conflict Resolutions? An Empirical AnalysisRangeet Pan, Vu Le, Nachiappan Nagappan, Sumit Gulwani et al.ICSE 2021 · 19 citations
- Grove: A Bidirectionally Typed Collaborative Structure Editor CalculusMichael D. Adams, Eric Griffis, Thomas Porter, Sundara Vishnu Satish et al.POPL 2025 · 3 citations
