Skip to content

🐛 --word-diff causes unpredictable behaviour #1957

@vxsl

Description

@vxsl

When git show or git diff is used with the --word-diff option, then piped into delta, the resulting output is often not highlighted correctly.

The issue seems to occur with any possible value of --word-diff. Oddly, it even occurs when --word-diff=plain is used, which should be equivalent to omitting the option, according to the documentation.

When the option is omitted, the output seems to always be highlighted correctly.

# in "delta" repo:

git show e3e92221 --word-diff=none | delta 
# > ... produces highlighted output about 50% of the time

git show e3e92221 | delta 
# > ... produces highlighted output 100% of the time

# to visually inspect multiple runs:
# while true; do git show e3e92221 | delta --paging=never; sleep 0.2; done
# while true; do git show e3e92221 --word-diff=none | delta --paging=never; sleep 0.2; done

intermittently incorrect output when --word-diff=<...> is used:

Image

reliably correct output when --word-diff=<...> is not used:

Image

There is obviously some sort of race condition here but unfortunately I do not have the time to investigate at the moment.
Found this bug while trying to address jonas/tig#1298 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions