一句话:提出语言无关补丁技术 mpatch,通过源到目标匹配定位变更,显著提升自动打补丁成功率并减少手工修复。
补丁是软件维护与演化中的基础任务,用于在不同版本间传播变更。GNU patch 与 Git cherry-pick 等语言无关工具依赖文本行号和上下文,源与目标差异时易失败,导致大量手工修复。本文构建并分析来自 5000 个 GitHub 项目的 40 万余个 cherry-pick 场景,评估现有补丁工具效果,进而提出语言无关技术 mpatch,利用源到目标匹配确定合适变更位置。实验表明,mpatch 比其他语言无关补丁工具多正确自动应用 44% 的补丁,并在无法完全自动化时减少手工修复,从而降低频繁打补丁项目的维护负担。
Patching is a fundamental software maintenance and evolution task enabling the (semi-)automated propagation of changes across different software versions. Established and widely used language-agnostic patchers, such as GNU patch and Git cherry-pick, work on textual artifact representations (i.e., text files) and typically rely on line numbers and contexts (i.e., surrounding unchanged text fragments) to apply changes. This strategy often fails if source and target of a patch differ, provoking cumbersome manual effort. In this paper, we study the effectiveness of commonly-used patchers, and propose a novel technique that significantly increases patch automation. First, we curate and analyze a large dataset of more than 400000 patch scenarios (i.e., cherry picks) from 5000 GitHub projects. Next, we examine the effectiveness of established patchers on the gathered patch scenarios. Third, we develop a novel language-agnostic patch technique, mpatch, that utilizes a source-to-target matching to determine suitable change locations. By comparing mpatch to other patchers, we find that it can correctly apply 44% more patches automatically than other language-agnostic patchers, while it also requires fewer manual fixes in cases that cannot be automated completely. Thus, mpatch considerably reduces the burden of manually fixing failed patches in practice, specifically in projects with frequent patch applications.
@inproceedings{paperbot11544,
title = {Decades of GNU Patch and Git Cherry-Pick: Can We Do Better?},
author = {Alexander Schultheiß and Alexander Boll and Paul Maximilian Bittner and Sandra Greiner and Thomas Thüm and Timo Kehrer},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3764537}
}