Git and Openoffice.org
Posted by Alec The Geek on 1 October 2009
N.B. These are very rough notes. See also
Sometime ago I shouted my mouth off at a local Perl Mongers meeting that using custom merge drivers it would be possible to auto merge OpenOffice document from Git, which seemed to interest some people greatly at the time.
However I then backtracked because I failed to take a few things into account. After some more investigation it turns out it should be possible (with some wrapper scripts and OpenOffice programming) and I *believe* the following approach stands a chance of working (I’m hedging my bets here)
1) Create a wrapper script that opens a document, switches on change recording and saves the document, called say changeRecordingOn
2) Create another wrapper script that takes two documents (a and b), runs the OpenOffice Edit->Changes->Merge Document function and saves the result as c, called say ooAutomerge(a,b,c) (NB Base revision is useless)
3) Create and associate a git custom merge tool for .odt and .ods files that runs ooAutomerge(). Might also need a custom merge driver?
4) Create a pre-commit hook that runs changeRecordingOn for all .odt and .ods files
When running a git-merge and then git-mergetool the OpenOffice GUI should be presented with a list of changes to accept/reject, which is much easier
NB It seems that running the OO merge and saving file c removes the previous change history. This means that if the file is merged again then the user only sees the new history since the last merge (which is what we want)
I doubt I will need this feature for some time so I don’t intend to take it further at the moment — however if you have a need, these notes might be useful..
I hope this makes sense? Apologies if I just swallowed two minutes of your day that could have been spend doing something better.
3 Responses to “Git and Openoffice.org”
Sorry, the comment form is closed at this time.

![[FSF Associate Member]](http://static.fsf.org/nosvn/associate/fsf-10505.png)
Tim said
Currently there is xmlmerge
http://xml.openoffice.org/xmerge/
and deltaxml
http://sourceforge.net/scm/?type=svn&group_id=29872
—
Versioning is something openoffice currently lacks and this is big problem for just about every document I produce in cooperation with anybody else.
If others are working on solution I will be glad to contribute and test.
Stephen1anter said
Great blog I’ve actually bookmarked it for learning linux. Can you recommend any books about linux for me? yep, I am a beginner of linux. :] thanks in advance.
Alec said
It’s funny you should ask — I recently blogged about that very question.