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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Doug Ireton <hidden>
Date: 2016-06-15 22:47:54

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

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

From: Jeff Epler <hidden>
Date: 2016-06-15 22:47:54

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help