mergetool 应该如何指示合并成功?

How should a mergetool indicate success of a merge?

我正在编写一个能够合并自定义二进制文件的程序。我想让 Git 信任我程序的退出代码,但似乎没有详细记录哪些退出代码确实表示成功。

git-mergetool 的文档指出:

If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable mergetool.<tool>.trustExitCode can be set to true. Otherwise, git mergetool will prompt the user to indicate the success of the resolution after the custom tool has exited.

但这并没有告诉我在哪种情况下使用哪些退出代码。 有什么想法吗?

Git 遵循 Unix/POSIX 标准约定:0 = 成功,非零通常表示某种失败。

经常(但不在 Git 中)2 用于不当使用诊断 and/or --help 输出;但是,同样经常,--help 会导致成功退出,Git 就是这种情况。 (同时 git not-a-git-command 导致状态 1。也就是说,失败产生一些帮助导致出口 1,而请求 for 帮助产生出口 0,在 Git.)

git bisect 命令还有一个特殊的退出代码,即 125,当从 git bisect run 调用的命令返回时,它会异常解释;请参阅 the documentation 以了解为什么 125 在这里意味着什么。