git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git and OpenDocument (OpenOffice.org) files

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 27, 2007, 09:52 UTC
Message-ID
<vpqk5rh5mp5.fsf@bauges.imag.fr>
Hi,

I found a way to use git comfortably with OpenDocument files (that is, what OpenOffice.org and Koffice produce. Text, Presentations and Spreadsheets).

Briefly, you have to install odf2txt ( http://stosberg.net/odt2txt/ ) and the script below, together with GIT_EXTERNAL_DIFF and/or diff drivers in .gitattributes. That give you the text diff you're used to.

Everything is documented here:
  http://www-verimag.imag.fr/~moy/opendocument/

Remarks are welcome (I'll post some remarks about Git's custom diff driver in a separate thread).

Script available from http://www-verimag.imag.fr/~moy/opendocument/git-oodiff and reproduced here :

#! /bin/sh

# Script acceptable as a value for GIT_EXTERNAL_DIFF. # For example, you can see the changes in your working tree with # # $ GIT_EXTERNAL_DIFF=git-oodiff diff

echo $0 "$@"
if odt2txt "$2"  > /tmp/oodiff.$$.1  && \
    odt2txt "$5" > /tmp/oodiff.$$.2 ; then
    if diff -L "a/$1" -L "b/$1" -u /tmp/oodiff.$$.{1,2}; then
        # no text change
        if diff -q "$2" "$5"; then
            : # no change at all
        else
            echo "OpenDocument files a/$1 and b/$1 files differ (same text content)"
        fi
    fi
else
    # conversion failed. Fall back to plain diff.
    diff -L "a/$1" -L "b/$1" -u "$2" "$5"
fi
rm -f /tmp/oodiff.$$.{1,2}
Next: Junio C Hamano
Message 1 of 12 in “Git and OpenDocument (OpenOffice.org) files”
  1. Matthieu MoyAug 27, 2007
  2. Junio C HamanoAug 27, 2007
  3. Matthieu MoyAug 27, 2007
  4. Mike HommeyAug 27, 2007
  5. Johannes SchindelinAug 27, 2007
  6. David KastrupAug 27, 2007
  7. Matthieu MoyAug 27, 2007
  8. Johannes SchindelinAug 27, 2007
  9. Mike HommeyAug 27, 2007
  10. Sergio CallegariAug 27, 2007
  11. Johannes SchindelinAug 27, 2007
  12. David KastrupAug 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.