LibreOffice / OpenOffice合并工具可以用作`git-mergetool`吗?

时间:2012-08-03 08:30:26

标签: git git-merge opendocument mergetool

我偶然发现an old blog post暗示这一点,不幸的是,这只是一个未实现的想法。这是否同时完成/如何实现? (我听说TortoiseGit可能会这样做,但我正在运行Linux)

一个替代方案也可以是提到here的重新拉链方法,建议一个git过滤器跟踪未压缩的OpenDocuments并在结帐时重新压缩它们,这将提供至少合并(和差异)xml的选项内容而不是二进制垃圾(或有损odt2txt),但是我没有找到关于这种方法的任何更新,最后post about this警告这种方法中的潜在缺陷。

2 个答案:

答案 0 :(得分:0)

你可以尝试一下,你会告诉我们。根据我的记忆,合并工具配置为有4个输入,因此您必须配置Git以将其用作合并工具。

您必须在配置文件中添加几行,merge.toolmergetool.<tool>.pathmergetool.<tool>.cmd

http://www.kernel.org/pub/software/scm/git/docs/git-config.html(在页面中搜索“merge.tool”)

http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html

希望有所帮助

答案 1 :(得分:0)

受到twalberg comment的启发,我写信给简单脚本od2fodfod2od,它们使用Libre / OpenOffice的--convert-to参数进行转换将压缩的xml压缩成未压缩的xml,反之亦然。由于bug denying CLI actions when the LibreOffice GUI is running我必须编写解决方法loInstance

#!/bin/bash
tmpdir=$(mktemp -d)
cp -rf ~/.libreoffice $tmpdir
soffice -env:UserInstallation=file://$tmpdir $@
rm -rf $tmpdir

od2fodfod2od很简单:

#!/bin/bash
loInstance --headless --convert-to f${1#*.} $1

#!/bin/bash
loInstance --headless --convert-to ${1#*.f} $1

现在可以在.gitattributes中设置cleansmudge过滤器,但是我注意到LO会跟踪多余的元数据,这些元数据会驱动clean-smudge圈。所以现在这只能用作textconv ...

的不完美git-diff工具