From 36c971cd275c4def7a9c8724fae4601f7bbd6c99 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Wed, 17 Aug 2011 09:41:24 -0600 Subject: [PATCH] Add git-diffall --- git-diffall | 38 ++++++++++++++++++++++++++++++++++++++ git-diffall.1 | 22 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 git-diffall create mode 100644 git-diffall.1 diff --git a/git-diffall b/git-diffall new file mode 100755 index 0000000..dd8dd46 --- /dev/null +++ b/git-diffall @@ -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 index 0000000..48bca66 --- /dev/null +++ b/git-diffall.1 @@ -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) -- 2.39.2