From: Stefan Beller <stefanbeller@gmail.com>
To: Simeon Krastnikov <skrastnikov@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Cc: gitster@pobox.com, phillip.wood@dunelm.org.uk
Subject: Re: Potential bug in --color-words output
Date: Mon, 7 Nov 2022 15:23:00 -0800 [thread overview]
Message-ID: <CALbm-EagU-kDg5wDO2z1canSifq0fo+hOqf8Xz1gAzbUO4COrQ@mail.gmail.com> (raw)
In-Reply-To: <198be0ca-4768-d3ce-caf3-bce4b1bb1e49@gmail.com>
Hi,
in my copy of git there is:
----
git % git grep --line-number --no-color color-words
Documentation/RelNotes/1.5.4.txt:377: * "git diff --color-words"
colored context lines in a wrong color.
Documentation/RelNotes/1.6.2.txt:100:* The definition of what
constitutes a word for "git diff --color-words"
Documentation/RelNotes/1.6.5.3.txt:23: * "git diff --color-words -U0"
didn't work correctly.
Documentation/RelNotes/1.7.2.txt:64: * "git diff --word-diff=<mode>"
extends the existing "--color-words"
Documentation/RelNotes/1.7.2.txt:141: * "git diff --graph" works
better with "--color-words" and other options
Documentation/diff-options.txt:475:--color-words[=<regex>]::
contrib/completion/git-completion.bash:1718:
--no-color --color-words --no-renames --check
contrib/diff-highlight/README:9:You can use "--color-words" to
highlight only the changed portions of
diff.c:1914: * '--color-words' algorithm can be described as:
diff.c:1929: * For '--graph' to work with '--color-words', we need to
output the graph prefix
diff.c:2138:/* In "color-words" mode, show word-diff of words
accumulated in the buffer */
diff.c:5566: OPT_CALLBACK_F(0, "color-words", options, N_("<regex>"),
gitk-git/gitk:207: "--color-words*" - "--word-diff=color" {
t/t4034-diff-words.sh:70: word_diff --color-words
t/t4034-diff-words.sh:100: word_diff --color-words &&
t/t4034-diff-words.sh:180: word_diff --color-words --unified=0
t/t4034-diff-words.sh:185: word_diff --color-words="[a-z]+"
t/t4034-diff-words.sh:190: word_diff --color-words="[a-z${LF}]*"
t/t4034-diff-words.sh:203: word_diff --color-words="[a-z]+"
t/t4034-diff-words.sh:208: word_diff --color-words
t/t4034-diff-words.sh:217: word_diff --color-words="[a-z]+"
t/t4034-diff-words.sh:240: word_diff --color-words
t/t4034-diff-words.sh:262: word_diff --color-words
t/t4034-diff-words.sh:278: word_diff --color-words="a+"
t/t4034-diff-words.sh:294: word_diff --color-words=.
----
So there are tests in t/t4034-diff-words.sh and probably around
diff.c:1914- diff.c:2138
Best,
Stefan
Am Mo., 7. Nov. 2022 um 12:43 Uhr schrieb Simeon Krastnikov
<skrastnikov@gmail.com>:
>
> Hi Junio, Phillip, and Stefan,
>
> I apologize for forwarding this to you personally, but based on the recent commit history, I figured that you would be the right persons to ask about this.
>
> Sorry again, if you consider this to be spam.
>
> Best,
>
> Simeon
>
>
>
> -------- Forwarded Message --------
> Subject: Potential bug in --color-words output
> Date: Fri, 28 Oct 2022 23:08:09 +0200
> From: Simeon Krastnikov <skrastnikov@gmail.com>
> To: git@vger.kernel.org
>
>
> Hello,
>
> Given an initial file with the contents "not to be", which I then change to "to be", the output of 'git diff --color-words', is
>
> notto be
>
> with the first three letters colored red. To me this seems incorrect as it implies, or at least misleadingly suggests, that there was no space between "not" and "to" in the original file. (Even though in that case the output is actually "nottoto be" with the "notto" in red and "to" in green.)
>
> If instead I start with a file with contents "to be", which I then change to "not to be", then the output is as expected:
>
> not to be
>
> (First three letters colored green.)
>
> Am I correct in seeing this as a bug? If so, any tips on what parts of diff.c to look at when starting a patch?
>
> Thanks,
>
> Simeon
>
next prev parent reply other threads:[~2022-11-07 23:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 21:08 Potential bug in --color-words output Simeon Krastnikov
[not found] ` <198be0ca-4768-d3ce-caf3-bce4b1bb1e49@gmail.com>
2022-11-07 23:23 ` Stefan Beller [this message]
2022-11-08 7:27 ` Johannes Sixt
2022-11-10 13:51 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALbm-EagU-kDg5wDO2z1canSifq0fo+hOqf8Xz1gAzbUO4COrQ@mail.gmail.com \
--to=stefanbeller@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=skrastnikov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).