# How can I get full filenames from Git difftool (for Microsoft Word “Compare Documents” feature)?

3 messages from 2009-12-14 to 2009-12-14. Participants: Doug Ireton, Matthieu Moy, Jeff Epler.
Thread: https://gitlist.dev/t/21947

## Doug Ireton, 2009-12-14 06:25

Subject: How can I get full filenames from Git difftool (for Microsoft Word “Compare Documents” feature)?
Message-ID: <b507cb050912132225j1bdc39c2v42a3bf6bddf1cb1a@mail.gmail.com>
URL: https://gitlist.dev/e/b507cb050912132225j1bdc39c2v42a3bf6bddf1cb1a%40mail.gmail.com
In-Reply-To: <b507cb050912132222x7e1daa9cw73b13f3db0ee22c6@mail.gmail.com>

```
I am using the latest version of Git (1.6.6) on a Mac. My wife wants
to use Git to manage her fiction writing as long as she can still use
Microsoft Word 2008 (Mac). Instead of pushing her into saving
everything as plain text, I would like to use Git Difftool to pass the
files to Word and use Word's Compare Documents feature. She wouldn't
be able to use Git Diff since Word docs are binary files but she could
still use Git Difftool.

I have written an Applescript which takes two filenames in this
format: /Users/foo/Documents/my_novel.docx and opens Word to do the
file comparison. However, Git Difftool seems to only pass the bare
filenames (e.g. my_novel.docx) as parameters.

Is there anyway to get the full filenames from Git Difftool?

Thanks,

Doug Ireton

```

## Matthieu Moy, 2009-12-14 07:55

Subject: Re: How can I get full filenames from Git difftool (for Microsoft Word “Compare Documents” feature)?
Message-ID: <vpqd42i56ra.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqd42i56ra.fsf%40bauges.imag.fr
In-Reply-To: <b507cb050912132225j1bdc39c2v42a3bf6bddf1cb1a@mail.gmail.com>

```
Doug Ireton <dougireton@gmail.com> writes:

> I am using the latest version of Git (1.6.6) on a Mac. My wife wants
> to use Git to manage her fiction writing as long as she can still use
> Microsoft Word 2008 (Mac). Instead of pushing her into saving
> everything as plain text, I would like to use Git Difftool to pass the
> files to Word and use Word's Compare Documents feature. She wouldn't
> be able to use Git Diff since Word docs are binary files but she could
> still use Git Difftool.

If you're interested in diff-ing the _text_ itself, you can use the
textconv filter of Git, together with antiword (or catdoc, which does
the same thing, but I think antiword works better).

See this:

http://git.or.cz/gitwiki/GitTips#HowtousegittotrackOpenDocument.28OpenOffice.2CKoffice.29files.3F

and adapt by replacing "OpenOffice" with MS Word, and odt2txt with
antiword.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jeff Epler, 2009-12-14 13:11

Subject: Re: How can I get full filenames from Git difftool (for Microsoft Word “Compare Documents” feature)?
Message-ID: <20091214131112.GC22735@unpythonic.net>
URL: https://gitlist.dev/e/20091214131112.GC22735%40unpythonic.net
In-Reply-To: <b507cb050912132225j1bdc39c2v42a3bf6bddf1cb1a@mail.gmail.com>

```
In the bash shell, you can convert a relative path to absolute by prepending
the directory name:
    mkabs () {
        case "$1" in
        /*) echo "$1" ;;
        *)  echo "$(pwd)/$1" ;;
        esac
    }

Using it at the shell prompt:
    $ mkabs example
    /home/jepler/example
    $ ls -l $(mkabs example)
    -rw-r--r-- 1 jepler jepler 0 2009-12-14 07:08 /home/jepler/example

If mac has a gnu-like readlink(1), then use 'readlink -f' instead of the
mkabs shell function:
    $ readlink -f example
    /home/jepler/example

You should be able to write a shell script which does the conversion
from relative to absolute using one of these patterns, and then invokes
the applescript.

It may turn out that there's a way to convert a path from relative to
absolute in applescript as well, but I wouldn't know it.

Jeff

```
