git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-kompare

From
JVJean-Marc Valin <jean-marc.valin@csiro.au>
Date
Aug 24, 2007, 05:40 UTC
Message-ID
<46CE6F56.70803@csiro.au>
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 -

Next: Andy Parkins
Message 1 of 5 in “git-kompare”
  1. Jean-Marc ValinAug 24, 2007
  2. Andy ParkinsAug 24, 2007
  3. Robin RosenbergAug 24, 2007
  4. Jean-Marc ValinAug 25, 2007
  5. Robin RosenbergAug 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.