Stuntman And Lover Of Cheese

by Dan Bostonweeks

Git and Changes.app: Take Two, the Right Way to Do It

Well, thanks to a pointer I found out that my git-chdiff script is a bit overblown. You see, a person can just use the built in functionality of <a href="http://git.or.cz/">git</a>, namely setting the GIT_EXTERNAL_DIFF environment variable to point to something that can take the seven command line arguments git will pass on to whatever you’ve set as your external command. It’s beautiful in its simplicity:

#!/bin/sh<br /> [ $# -eq 7 ] && /usr/bin/env chdiff --wait "$2" "$5"

Just stick that in a script file, make it executable, set the GIT_EXTERNAL_DIFF environment variable to point at it and away you go. I’ve also documented it in the Changes.app wiki. I feel so silly for not finding this before, but the exercise in a scripted solution was good for me.