The existing 'git difftool' command allows the user to view git diffs
using an external diff tool. However, if multiple files contain
differences, a separate instance of the diff tool is launched for
each one.
This script launches a single instance of the external diff tool
and performs a directory diff between the specified revisions.
The before/after files are copied to a tmp directory to do this.
The 'diff.tool' configuration option must be set for this script
to work.
The user interface matches the standard 'git diff' command.
Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---
This script is based on an example provided by Thomas Rast on the Git list [1].
I tested with:
- msysgit and kdiff3 (the platform where I first needed this script)
- cygwin git and kdiff3
- git and meld
[1] http://thread.gmane.org/gmane.comp.version-control.git/124807
contrib/diffall/git-diffall | 159 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 159 insertions(+), 0 deletions(-)
create mode 100755 contrib/diffall/git-diffall
diff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall
new file mode 100755
index 0000000..c24fba9
--- /dev/null
+++ b/contrib/diffall/git-diffall
@@ -0,0 +1,159 @@
+#!/bin/sh -e
+# Copyright 2010, Tim Henigan <tim.henigan@gmail.com>
+#
+# Perform a directory diff between commits in the repository using
+# the external diff tool specified in the 'diff.tool' configuration
+# option.
+
+USAGE='<options> <commit>{0,2} -- <path>*
+
+--cached Compare to the index rather than the working tree
+commit SHA1 of a commit
+path Limit the diff to the specified paths
+'
+
+. git-sh-setup
+
+if [ -z $(git config --get diff.tool) ]; then
+ echo "Error: The 'diff.tool' configuration option must be set."
+ usage
+fi
+
+start_dir=$(pwd)
+cd_to_toplevel # needed to access tar utility
+
+# mktemp is not available on all platforms (missing from msysgit)
+# Use a hard-coded tmp dir if it is not ...