Subject: git-kompare

From: Jean-Marc Valin <[email-masked]>
Date: Fri, 24 Aug 2007 15:40:38 +1000

Hi,

I just wrote this tiny git-kompare script that I thought some may be
interested in. It basically does a visual diff using kompare. If it
weren't for bugs in kompare, the script would basically do:

git diff --unified=99999 $* | kompare -

As you can see, I really suck at shell programming, so this isn't
intended for being merged, although probably anyone with a clue about
shell can probably rewrite it in a slightly cleaner way. At the moment,
the only case it doesn't handle is when a file gets added and the
initial source is /dev/null.

Bugs it works around are:
- Unrecognised git syntax
(http://mail.kde.org/pipermail/kompare-devel/2006-August/000141.html
which is fixed in some later version of kompare I think)
- Kompare doesn't know about /dev/null as a file (fixed only for removal)
- Kompare doesn't like it when the first file in the diff isn't in the
root of the repository.

Hope it's useful for someone (I really like it).

Cheers,

	Jean-Marc
#!/bin/sh
(echo "Index: a\n--- a\n+++ a\n@@ -1,1 +1,1 @@\n-\n+\n"; git diff --unified=99999 $* | perl -ne 's/\/dev\/null/toto/; if (/^\+\+\+/) {s/^\+\+\+ b\/(.*)$/+++ $1\t(old version)/;} if (/^---/) {s/^--- a\/(.*)$/--- $1\t(new version)/;} print;') | kompare -