Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of uninitialized value in addition #438

Open
dbeecham opened this issue Jul 4, 2022 · 9 comments
Open

Use of uninitialized value in addition #438

dbeecham opened this issue Jul 4, 2022 · 9 comments

Comments

@dbeecham
Copy link

dbeecham commented Jul 4, 2022

I get this error when running diff-so-fancy:

Use of uninitialized value in addition (+) at diff-so-fancy line 947, <STDIN> line 25.
``
@astorije-vmware
Copy link

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

@scottchiefbaker
Copy link
Contributor

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.

@rxgx
Copy link

rxgx commented Aug 30, 2022

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?

Screen Shot 2022-08-30 at 11 55 39 AM

@rxgx
Copy link

rxgx commented Aug 30, 2022

If I remove this line from my ~/.gitconfig file, I no longer get the addition error.

[color "diff"]
    ...
-   meta = normal
    ...

scottchiefbaker added a commit that referenced this issue Aug 30, 2022
@scottchiefbaker
Copy link
Contributor

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

@zaufi
Copy link

zaufi commented Jan 25, 2023

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

@webstech
Copy link
Contributor

The git-ansi-color routine does not appear to support:

@sergeylukin
Copy link

Same here. emptying [color "diff"] in ~/.gitconfig solves it but it would be great if diff-so-fancy would support custom [color "diff"] settings.

ofus added a commit to ofus/dotfiles that referenced this issue May 1, 2023
There's a bug in diff-so-fancy which breaks when used as git diff with
some values in my git config colors

I commented it out.  The issue is being worked on in diff-so-fance

so-fancy/diff-so-fancy#438
@scottchiefbaker
Copy link
Contributor

This appears to be related to d-s-f not supporting hex colors, and not understanding "normal" and "default".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants