Re: [RFD] Strange patch formats (aka tricks with unified diffs)..

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFD] Strange patch formats (aka tricks with unified diffs)..

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

Johannes Schindelin [off-list ref] writes:
On Thu, 12 Apr 2007, Junio C Hamano wrote:
quoted
[...] the --color-words (whose implementation I happen to hate) [...]
I know that we talked about it previously. And strictly, I think it is not 
the implementation that you hate, but the rules that were implemented.

I'll have a look at what you wrote back then, and try to come up with some 
sensible alternatives, so you don't have to hate the code so much.
One sensible behaviour would be to show exactly the same output
lines as the regular output, but color-code only the words that
changed.  E.g (the words are capitalized to illustrate instead
of colored here):

        diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt
        index 6a5fcfd..535214c 100644
        --- a/Documentation/git-cvsserver.txt
        +++ b/Documentation/git-cvsserver.txt
        @@ -125,7 +131,7 @@ By default it uses SQLite databases in the git directory, named
         temporary files in the same directory as the database file on
         write so it might not be enough to grant the users using
         git-cvsserver write access to the database file without granting
        -them ALSO write access to the directory.
        +them write access to the directory, TOO.

         You can configure the database backend with the following
         configuration variables:

Re: [RFD] Strange patch formats (aka tricks with unified diffs)..

From: Jeff King <hidden>
Date: 2016-06-15 22:43:04

On Sat, Apr 14, 2007 at 02:55:13AM -0700, Junio C Hamano wrote:
One sensible behaviour would be to show exactly the same output
lines as the regular output, but color-code only the words that
changed.  E.g (the words are capitalized to illustrate instead
of colored here):
That works great for highlighting a small change between two very
similar lines (and I think that is one use of --color-words). However,
it's terrible for the other use of color words, which is showing changes
which are not well-adapted to line oriented diffs (such as flowed text).

Try this:

cat >orig <<EOF
this is a paragraph that has
some text in it and is wrapped
at 30 characters
EOF

cat >rewrapped <<EOF
this is yet another paragraph
that has some text in it and
is wrapped at 30 characters
EOF

git-diff --color orig rewrapped
git-diff --color-words orig rewrapped


I think one behavior is best for one situation, and the other behavior
for another situation. Perhaps there is room for two modes?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help