threads / discuss / 9632

git-kompare

Subject: git-kompare

## tl;dr

5 messages between Aug 24, 2007 and Aug 25, 2007.

replies: 4people: 3as markdown or json

Jean-Marc Valin· Aug 24, 2007, 05:40 UTC · lore
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 -

Andy Parkins· Aug 24, 2007, 17:13 UTC · re: Jean-Marc Valin · lore

Re: git-kompare

On Friday 2007, August 24, Jean-Marc Valin wrote:
> (http://mail.kde.org/pipermail/kompare-devel/2006-August/000141.html
> which is fixed in some later version of kompare I think)

I was the original reporter of that bug; I have to say the kompare developers were fairly quick on the uptake and fixed that problem with the next realease of kompare - which came very soon after the report. I just waited for it to arrive in debian unstable, which also happened fairly quickly. If you are seriously that far behind in your kompare version I strongly suggest upgrading, I mean, if it's in debian then it's in everything else :-)

I found it quite nostalgic seeing that report, as I made the report a few days after my first use of git, which means I've just had my git anniversary. How quickly time flys - I can hardly believe I ever managed without it now.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Robin Rosenberg· Aug 24, 2007, 19:52 UTC · re: Andy Parkins · lore

Re: git-kompare

fredag 24 augusti 2007 skrev Andy Parkins:
Show 8 quoted lines
> On Friday 2007, August 24, Jean-Marc Valin wrote:
> 
> > (http://mail.kde.org/pipermail/kompare-devel/2006-August/000141.html
> > which is fixed in some later version of kompare I think)
> 
> I was the original reporter of that bug; I have to say the kompare 
> developers were fairly quick on the uptake and fixed that problem with the 
> next realease of kompare - which came very soon after the report.  I just 
I am more of a GIT developer than a KDE developer.
> waited for it to arrive in debian unstable, which also happened fairly 
> quickly.  If you are seriously that far behind in your kompare version I 
> strongly suggest upgrading, I mean, if it's in debian then it's in 
> everything else :-)

Adding the patch to your version isn't hard. Just download the source package and add the patch in the patches section and rebuild. That's how I lived with the fix until Mandriva delivered a newer KDE version. Thanks to the kdesdk src rpm I could rebuild the package fairly easily without dowloading, configuring and builing most of KDE. The src rpm declare the dependencies I need. My guess is that is about as easy with dpkg, ebuilds or ports.

> I found it quite nostalgic seeing that report, as I made the report a few 
> days after my first use of git, which means I've just had my git 
> anniversary.  How quickly time flys - I can hardly believe I ever managed 
> without it now.

This was about two months after starting to use git in my case. My first git bug was encountered abour ten minutes after trying git. (Linus fixed the bug the day after).

-- robin
Jean-Marc Valin· Aug 25, 2007, 00:17 UTC · re: Robin Rosenberg · lore

Re: git-kompare

Show 6 quoted lines
> Adding the patch to your version isn't hard. Just download the source package
> and add the patch in the patches section and rebuild. That's how I lived with
> the fix until Mandriva delivered a newer KDE version. Thanks to the kdesdk src
> rpm I could rebuild the package fairly easily without dowloading, configuring
> and builing most of KDE. The src rpm declare the dependencies I need. My 
> guess is that is about as easy with dpkg, ebuilds or ports.

Unless I missed something, there are more things to work around than the one that was fixed in your patch, no? For example, the fact that kompare doesn't understand when the filename is /dev/null. As for upgrading kompare, I'm all for the idea, but the KDE folks aren't making that easy. The only link in the Kompare download section is for www.kde.org, which isn't making the source code any easier to find (including a 404 link for "Source code" on the front page!). Any direct link?

BTW, I'm running the latest Ubuntu (Feisty) that ships with kompare 3.4.
	Jean-Marc
Robin Rosenberg· Aug 25, 2007, 10:25 UTC · re: Jean-Marc Valin · lore

Re: git-kompare

lördag 25 augusti 2007 skrev Jean-Marc Valin:
Show 10 quoted lines
> > Adding the patch to your version isn't hard. Just download the source package
> > and add the patch in the patches section and rebuild. That's how I lived with
> > the fix until Mandriva delivered a newer KDE version. Thanks to the kdesdk src
> > rpm I could rebuild the package fairly easily without dowloading, configuring
> > and builing most of KDE. The src rpm declare the dependencies I need. My 
> > guess is that is about as easy with dpkg, ebuilds or ports.
> 
> Unless I missed something, there are more things to work around than the
> one that was fixed in your patch, no? For example, the fact that kompare
> doesn't understand when the filename is /dev/null. As for upgrading

I'm on 3.5.7 now so I cannot easily test 3.5.6 with the patch anymore, but on *my machine* diffs (including git diffs) with /dev/null work just fine.

-- robin
> kompare, I'm all for the idea, but the KDE folks aren't making that
> easy. The only link in the Kompare download section is for www.kde.org,
> which isn't making the source code any easier to find (including a 404
> link for "Source code" on the front page!). Any direct link?

I suggested *not* to upgrade completely. Go to ubunu's home page and look for package sources and how to modify them. Ubuntu uses the same package format as Debian so instructions for Debian will most likely apply for Ubuntu.

- robin

← back to recent threads