]> oss.titaniummirror.com Git - git-utils.git/commitdiff
Add git-diffall
authorR. Steve McKown <rsmckown@gmail.com>
Wed, 17 Aug 2011 15:41:24 +0000 (09:41 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Wed, 17 Aug 2011 15:41:24 +0000 (09:41 -0600)
git-diffall [new file with mode: 0755]
git-diffall.1 [new file with mode: 0644]

diff --git a/git-diffall b/git-diffall
new file mode 100755 (executable)
index 0000000..dd8dd46
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. "$(git --exec-path)/git-sh-setup"
+cd_to_toplevel # for the tar below
+
+pre="${1-HEAD}"
+post="$2"
+
+tmp="$(mktemp -d)"
+
+cleanup () {
+       rm -rf $tmp
+}
+
+trap cleanup EXIT
+
+mkdir "$tmp"/a "$tmp"/b
+
+if [ -n "$post" ]; then
+       git diff --name-only "$pre" "$post" > "$tmp"/filelist
+       while read name; do
+               mkdir -p "$tmp"/b/"$(dirname "$name")"
+               git show "$post":"$name" > "$tmp"/b/"$name"
+       done < "$tmp"/filelist
+else
+       git diff --name-only "$pre" > "$tmp"/filelist
+       tar -c -T "$tmp"/filelist | (cd "$tmp"/b && tar -x)
+fi
+
+while read name; do
+       mkdir -p "$tmp"/a/"$(dirname "$name")"
+       git show "$pre":"$name" > "$tmp"/a/"$name"
+done < "$tmp"/filelist
+
+cd "$tmp"
+#meld a b
+#diff -ur a b
+kdiff3 a b
diff --git a/git-diffall.1 b/git-diffall.1
new file mode 100644 (file)
index 0000000..48bca66
--- /dev/null
@@ -0,0 +1,22 @@
+.\"
+.TH "git-diffall"
+.SH NAME
+git-diffall \- Use a visual diff tool to show all differences
+
+.SH SYNOPSIS
+\fBgit-diffall\fR [\fIPRE\fR] [\fIPOST\fR]
+
+.SH "DESCRIPTION"
+
+.PP
+\fBgit-diffall\fR performs a visual diff using kdiff3 between PRE and POST
+of the current project.  No arguments will show the differences between the
+working directory and HEAD.  Later this tool can be improved upon to use the
+tool listed in the config file (difftool), or if none present fall back to
+a 'normal' git diff.
+
+Thanks to Thomas Rast for publishing this script online:
+http://thread.gmane.org/gmane.comp.version-control.git/124807
+
+.SH "SEE ALSO"
+git-diff(1)