Doug
Doug

Reputation: 3149

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

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

Upvotes: 1

Views: 592

Answers (2)

upe
upe

Reputation: 2124

To get the full paths of modified files in bash I use:

git diff --name-only | while read file; do echo "$(pwd)/$file"; done

Upvotes: 0

Tobu
Tobu

Reputation: 25426

Your applescript knows what the current directory is, make it use it.

Or you could write a wrapper script, bash does the job:

#!/bin/bash
exec YourAppleScript "$(realpath "$1")" "$(realpath "$2")"

Save file and make it executable.

Upvotes: 0

Related Questions