git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitk: how to apply '--color-words' to the diff command
@ 2008-03-17 19:18 Dirk Süsserott
  2008-03-18 20:55 ` Dirk Süsserott
  2008-03-18 20:58 ` Dirk Süsserott
  0 siblings, 2 replies; 3+ messages in thread
From: Dirk Süsserott @ 2008-03-17 19:18 UTC (permalink / raw)
  To: Git Mailing List

Hello,

a few days ago I found a patch for gitk that adds a checkbox 'Ignore 
space change' to the gitk GUI and -- when clicked -- adds the '-w' 
switch to the diff command. I found that a very convenient way to see 
'what has really changed'. The patch was contributed by Steffen Prohaska 
and has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the
git://git.kernel.org/pub/scm/git/git.git repository.

Inspired by this, I thought a '--color-words' switch would be even more
convenient. I took the patch as a template and kinda replaced all
occurences of '-w' with '--color-words' (do not take this literally).

Unfortunately gitk then shows the diffs not colorized but with those 
ugly escape sequences instead. I'm not a Python person and just able to 
'copy and waste', but probably some of you had the same idea and got it 
right.

Dirk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gitk: how to apply '--color-words' to the diff command
  2008-03-17 19:18 gitk: how to apply '--color-words' to the diff command Dirk Süsserott
@ 2008-03-18 20:55 ` Dirk Süsserott
  2008-03-18 20:58 ` Dirk Süsserott
  1 sibling, 0 replies; 3+ messages in thread
From: Dirk Süsserott @ 2008-03-18 20:55 UTC (permalink / raw)
  To: Git Mailing List

>
> a few days ago I found a patch for gitk that adds a checkbox 'Ignore 
> space change' to the gitk GUI and -- when clicked -- adds the '-w' 
> switch to the diff command. I found that a very convenient way to see 
> 'what has really changed'. The patch was contributed by Steffen 
> Prohaska and has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the
> git://git.kernel.org/pub/scm/git/git.git repository.
>
> Inspired by this, I thought a '--color-words' switch would be even more
> convenient. I took the patch as a template and kinda replaced all
> occurences of '-w' with '--color-words' (do not take this literally).
>
> Unfortunately gitk then shows the diffs not colorized but with those 
> ugly escape sequences instead. I'm not a Python person and just able 
> to 'copy and waste', but probably some of you had the same idea and 
> got it right.
>
I'm not only not a Python person but also not a Tcl person. Did't even 
figure out the difference. :-(

However, what I figured out is that it's not as simple as I thought: The 
colorization in question is hard coded in the last 'else' branch of 
'getblobdiffline'. When a line starts with a '+' or '-', then it's shown 
in green or red. To support the --color-words switch it would be 
neccessary to actually parse diff's output wrt. to the colors. Not that 
easy, I guess.

Sorry for the noise.

Dirk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gitk: how to apply '--color-words' to the diff command
  2008-03-17 19:18 gitk: how to apply '--color-words' to the diff command Dirk Süsserott
  2008-03-18 20:55 ` Dirk Süsserott
@ 2008-03-18 20:58 ` Dirk Süsserott
  1 sibling, 0 replies; 3+ messages in thread
From: Dirk Süsserott @ 2008-03-18 20:58 UTC (permalink / raw)
  To: Git Mailing List

>
> a few days ago I found a patch for gitk that adds a checkbox 'Ignore 
> space change' to the gitk GUI and -- when clicked -- adds the '-w' 
> switch to the diff command. I found that a very convenient way to see 
> 'what has really changed'. The patch was contributed by Steffen 
> Prohaska and has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the
> git://git.kernel.org/pub/scm/git/git.git repository.
>
> Inspired by this, I thought a '--color-words' switch would be even more
> convenient. I took the patch as a template and kinda replaced all
> occurences of '-w' with '--color-words' (do not take this literally).
>
> Unfortunately gitk then shows the diffs not colorized but with those 
> ugly escape sequences instead. I'm not a Python person and just able 
> to 'copy and waste', but probably some of you had the same idea and 
> got it right.
>
I'm not only not a Python person but also not a Tcl person. Did't even 
figure out the difference. Sorry for that.

However, what I figured out is that it's not as simple as I thought: The 
colorization in question is hard coded in the last 'else' branch of 
'getblobdiffline'. When a line starts with a '+' or '-', then it's shown 
in green or red. To support the --color-words switch it would be 
neccessary to actually parse diff's output wrt. to the colors.

Sorry for the noise.

Dirk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-20  1:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 19:18 gitk: how to apply '--color-words' to the diff command Dirk Süsserott
2008-03-18 20:55 ` Dirk Süsserott
2008-03-18 20:58 ` Dirk Süsserott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).