diff-so-fancy
diff-so-fancy copied to clipboard
Use of uninitialized value in addition
I get this error when running diff-so-fancy:
Use of uninitialized value in addition (+) at diff-so-fancy line 947, <STDIN> line 25.
``
I'm getting something similar here:
Use of uninitialized value in addition (+) at /usr/local/bin/diff-so-fancy line 967.
Obtained while trying to run git diff
.
Installed from Homebrew:
% brew info diff-so-fancy
==> diff-so-fancy: stable 1.4.3 (bottled), HEAD
Good-lookin' diffs with diff-highlight and more
https://github.com/so-fancy/diff-so-fancy
/usr/local/Cellar/diff-so-fancy/1.4.3 (8 files, 46.3KB) *
Poured from bottle on 2022-08-25 at 10:24:20
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/diff-so-fancy.rb
License: MIT
The parts of my ~/.gitconfig
that could be relevant:
[core]
excludesfile = ~/.gitignore_global
pager = diff-so-fancy | less --tabs=4 -RFX
[diff]
# Enables a heuristic to make the patch output more readable by using a blank
# line as a strong hint that the contents before and after it belong to
# logically separate units. It is still experimental.
compactionHeuristic = true
[diff-so-fancy]
# Do not color the first block of an empty line.
markEmptyLines = false
# Do not remove the pesky + or - at line-start.
stripLeadingSymbols = false
[color "diff"]
meta = yellow # Default is white
frag = magenta # Default is cyan
[color "diff-highlight"]
oldNormal = red
newNormal = green
oldHighlight = "#dd0000 #550000" # Default is red reverse
newHighlight = "green #004400" # Default is green reverse
Line 967 does not contain addition. I'm confused trying to track down the bug.
Can you try it again with the official release? That should at least give us consistent line numbers.
For the diff-so-fancy
error I am receiving at:
Use of uninitialized value in addition (+) at /Users/rgasparini/.volta/tools/image/packages/diff-so-fancy/bin/diff-so-fancy line 1282, <STDIN> line 28.
is some color setting in ~/.gitconfig
that is not expected?

If I remove this line from my ~/.gitconfig
file, I no longer get the addition error.
[color "diff"]
...
- meta = normal
...
@rxgx I just posted a potential fix on the next
branch. Can you see if that fixes your problem?
We don't support "normal" in a gitconfig, but it should fail silently. I put "normal" in my gitconfig like you posted and I don't get an error. This one is a little confusing.
Commenting meta
didn't help much... the same error, but another lineno :(
Use of uninitialized value in addition (+) at /usr/host/bin/diff-so-fancy line 1282, <STDIN> line 25.
Same error I have even for diff -u file1 file2 | diff-so-fancy
from the README
.
My Git colors:
[color "diff"]
#meta = "#328cad" "" italic
frag = "#b060ff" "" italic
func = "#6b41a7" "" italic
old = "#c05040"
new = "#20ff70"
commit = "#30b0c0"
whitespace = "" "#c05040"
oldMoved = "#c03060"
newMoved = "#50b060"
oldMovedDimmed = "#802030"
oldMovedAlternative = "#d05030"
oldMovedAlternativeDimmed = "#a03020"
newMovedDimmed = "#307040"
newMovedAlternative = "#70e0a0"
newMovedAlternativeDimmed = "#407050"
Upd: I have to comment everything up to comment
to make it work
The git-ansi-color
routine does not appear to support:
-
normal
anddefault
as basic colors - 24-bit RGB values as hex, like #ff0ab3 (quoting from the git manual). Issue #446 requested this. @zaufi
Same here. emptying [color "diff"]
in ~/.gitconfig
solves it but it would be great if diff-so-fancy would support custom [color "diff"]
settings.
This appears to be related to d-s-f not supporting hex colors, and not understanding "normal" and "default".