# [StGit] How do I get colored diff output?

5 messages from 2007-08-30 to 2007-08-31. Participants: Peter Baumann, Catalin Marinas, Jakub Narebski.
Thread: https://gitlist.dev/t/9706

## Peter Baumann, 2007-08-30 12:32

Subject: [StGit] How do I get colored diff output?
Message-ID: <20070830123222.GG5050@xp.machine.xx>
URL: https://gitlist.dev/e/20070830123222.GG5050%40xp.machine.xx

```
Hi,

Is there a way to get colored diff output, preferable from the native
git diff without having to specify stg diff -O --color everytime?
It seems that stg doesn't honor color.diff config entry, so I am a
little lost.

(And yes I now that I could use the pager setting given in examples/gitconfig,

	stgit.pager = filterdiff --annotate | colordiff | less -FRX

 but I really prefere the native git coloring, which looks a loot nicer
 and does also highlight traling whitespace)

-Peter

```

## Catalin Marinas, 2007-08-30 13:22

Subject: Re: [StGit] How do I get colored diff output?
Message-ID: <tnx3ay1w40p.fsf@arm.com>
URL: https://gitlist.dev/e/tnx3ay1w40p.fsf%40arm.com
In-Reply-To: <20070830123222.GG5050@xp.machine.xx>

```
Peter Baumann <waste.manager@gmx.de> wrote:
> Is there a way to get colored diff output, preferable from the native
> git diff without having to specify stg diff -O --color everytime?
> It seems that stg doesn't honor color.diff config entry, so I am a
> little lost.
>
> (And yes I now that I could use the pager setting given in examples/gitconfig,
>
> 	stgit.pager = filterdiff --annotate | colordiff | less -FRX
>
>  but I really prefere the native git coloring, which looks a loot nicer
>  and does also highlight traling whitespace)

There isn't any other way at the moment. There were ideas of adding
support for default command line options for various commands but I
haven't looked at this.

I now tried the example stgit.pager option and it looks bad indeed. In
the meantime, there is a diffcol.sh script in the contrib directory, I
use this instead and it looks much nicer.

-- 
Catalin

```

## Peter Baumann, 2007-08-30 13:59

Subject: Re: [StGit] How do I get colored diff output?
Message-ID: <20070830135909.GH5050@xp.machine.xx>
URL: https://gitlist.dev/e/20070830135909.GH5050%40xp.machine.xx
In-Reply-To: <tnx3ay1w40p.fsf@arm.com>

```
On Thu, Aug 30, 2007 at 02:22:46PM +0100, Catalin Marinas wrote:
> Peter Baumann <waste.manager@gmx.de> wrote:
> > Is there a way to get colored diff output, preferable from the native
> > git diff without having to specify stg diff -O --color everytime?
> > It seems that stg doesn't honor color.diff config entry, so I am a
> > little lost.
> >
> > (And yes I now that I could use the pager setting given in examples/gitconfig,
> >
> > 	stgit.pager = filterdiff --annotate | colordiff | less -FRX
> >
> >  but I really prefere the native git coloring, which looks a loot nicer
> >  and does also highlight traling whitespace)
> 
> There isn't any other way at the moment. There were ideas of adding
> support for default command line options for various commands but I
> haven't looked at this.
> 
> I now tried the example stgit.pager option and it looks bad indeed. In
> the meantime, there is a diffcol.sh script in the contrib directory, I
> use this instead and it looks much nicer.
> 

Ah. I didn't find that while searching for the color ouput.

Thx for your help,
Peter

```

## Jakub Narebski, 2007-08-30 16:57

Subject: Re: [StGit] How do I get colored diff output?
Message-ID: <fb6sst$6rt$2@sea.gmane.org>
URL: https://gitlist.dev/e/fb6sst%246rt%242%40sea.gmane.org
In-Reply-To: <tnx3ay1w40p.fsf@arm.com>

```
Catalin Marinas wrote:

> I now tried the example stgit.pager option and it looks bad indeed. In
> the meantime, there is a diffcol.sh script in the contrib directory, I
> use this instead and it looks much nicer.

That means it should be not removed even though git-diff learned --color...

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Catalin Marinas, 2007-08-31 15:14

Subject: Re: [StGit] How do I get colored diff output?
Message-ID: <tnxveavviqe.fsf@arm.com>
URL: https://gitlist.dev/e/tnxveavviqe.fsf%40arm.com
In-Reply-To: <fb6sst$6rt$2@sea.gmane.org>

```
Jakub Narebski <jnareb@gmail.com> wrote:
> Catalin Marinas wrote:
>
>> I now tried the example stgit.pager option and it looks bad indeed. In
>> the meantime, there is a diffcol.sh script in the contrib directory, I
>> use this instead and it looks much nicer.
>
> That means it should be not removed even though git-diff learned
> --color...

It looks nicer than "filterdiff | colordiff" (and probably pretty
similar to the git-diff --color output).

It shouldn't be removed yet because there is no support in StGIT to
pass these options automatically. Since StGIT uses git-diff-tree/index
directly, always passing the --color option to these tools is not
feasible as they cannot detect whether the output is tty or file. This
functionality is currently handled by the pydoc.pager function.

Using git-diff would require a bit of work as well since StGIT first
captures the output and displays it afterwards via pydoc.pager. We
might change this at some point since GIT now has proper support for
PAGER.

-- 
Catalin

```
