git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] gitk --color-words
@ 2010-03-31  0:52 Thomas Rast
  2010-03-31  0:52 ` [PATCH 1/2] Add diff --porcelain option for --color-words Thomas Rast
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Thomas Rast @ 2010-03-31  0:52 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Eelis van der Weegen, Paul Mackerras

This little pair of patches teaches gitk a color-words diff view.

To get there, I finally got rid of the assumption that --color-words
only ever needs to output ANSI(?) color sequences.  Hopefully this
will help other people to use --color-words in nice frontends.

It uses an ad-hoc output format where newlines in the output are
insignificant (so as to be able to speak about added/removed words)
and newlines from the input are output as a line with only a '~'.

RFC among other things because

* I chose ~ more or less randomly.  Do any diff implementations out
  there use it for some other purpose?

* The --color-words code was the only user of color_fwrite_lines() so
  I tweaked it according to my needs.  But that makes it highly
  diff-specific again, so it's not in color.c any more.  Did anyone
  else intend to use it?

* The Tk part of the patch is 95% voodoo of the
  cut&paste-from-elsewhere vintage and I have no clue whether it works
  only by accident

* I still need to do some things: add docs for --porcelain, add tests
  to the first patch, move the gitk patch to affect only the subtree

* I'm not even burning midnight oil any more

Thomas Rast (2):
  Add diff --porcelain option for --color-words
  gitk: add the equivalent of diff --color-words

 color.c       |   28 ---------------
 color.h       |    1 -
 diff.c        |  105 +++++++++++++++++++++++++++++++++++++++++++++++---------
 diff.h        |    1 +
 gitk-git/gitk |   29 +++++++++++++++-
 5 files changed, 116 insertions(+), 48 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/2] gitk --color-words
@ 2010-04-04 13:46 Thomas Rast
  2010-04-04 13:46 ` [PATCH 2/2] gitk: add the equivalent of diff --color-words Thomas Rast
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Rast @ 2010-04-04 13:46 UTC (permalink / raw)
  To: git
  Cc: Johannes Schindelin, Eelis van der Weegen, Junio C Hamano,
	Paul Mackerras, Miles Bader

Miles Bader wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> > How readable can you make this for human consumption while still keeping
> > it machine readable?  The answer could be it already is human readble.
> >
> > Two reasons I ask the above question are that I find the feature quite
> > interesting, and would want to see if it can be also fed to humans, and
> > that the combination of this new option and the existing --color-words is
> > misnamed.
> 
> There's the format used by the "wdiff" program, which is more like
> traditional diff output in that it doesn't use color, but is human
> friendly, and also seems to be somewhat machine-parseable:
> 
>    $ echo 'This is a test' > /tmp/a
>    $ echo 'This is funky test' > /tmp/b
>    $ wdiff /tmp/a /tmp/b
>    This is [-a-] {+funky+} test
> 
> [I say "somewhat" because wdiff itself doesn't appear to escape potentially
> ambiguous content, e.g., if there's actually a "{+" in the file....]

Junio C Hamano wrote:
> If you call this --word-diff, then it would become more clear that
> --color-words perhaps should have been called --word-diff=color or
> something.

Excellent ideas!  I don't have anything to add ;-)

This makes [1/2] a rather new patch though, I moved the whole
prefix/suffix handing further out to accommodate different styles.

There's a little change in [2/2] apart from the obvious option
renaming, too: it interprets --color-words and --word-diff as an
initial setting for the checkbox.


Thomas Rast (2):
  diff: add --word-diff option that generalizes --color-words
  gitk: add the equivalent of diff --color-words

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

end of thread, other threads:[~2010-04-05 10:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  0:52 [RFC PATCH 0/2] gitk --color-words Thomas Rast
2010-03-31  0:52 ` [PATCH 1/2] Add diff --porcelain option for --color-words Thomas Rast
2010-03-31  0:52 ` [PATCH 2/2] gitk: add the equivalent of diff --color-words Thomas Rast
2010-03-31 12:04   ` Thomas Rast
2010-04-03 18:06 ` [PATCH v2 0/2] gitk --color-words Thomas Rast
2010-04-03 18:06   ` [PATCH v2 1/2] Add diff --porcelain option for --color-words Thomas Rast
2010-04-03 19:15     ` Junio C Hamano
2010-04-03 22:38       ` Miles Bader
2010-04-03 18:06   ` [PATCH v2 2/2] gitk: add the equivalent of diff --color-words Thomas Rast
2010-04-05  6:40   ` [PATCH v2 0/2] gitk --color-words Paul Mackerras
2010-04-05 10:21     ` Thomas Rast
  -- strict thread matches above, loose matches on Subject: below --
2010-04-04 13:46 [PATCH " Thomas Rast
2010-04-04 13:46 ` [PATCH 2/2] gitk: add the equivalent of diff --color-words Thomas Rast

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).