Wilfred / difftastic

a structural diff that understands syntax 🟥🟩

Home Page:https://difftastic.wilfred.me.uk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Text (exceeded DFT_GRAPH_LIMIT)

ElijahLynn opened this issue · comments

Thanks for reporting a bug! Please include all of the following:

(1) A description of the issue. A screenshot is often helpful too.

First time trying to use difftastic and my first comparison resulted in the error:

 Text (exceeded DFT_GRAPH_LIMIT)

image

I found #316 and tried setting set --export DFT_GRAPH_LIMIT 5000000 (fish) but no go on resolving this.

(2) A copy of what you're diffing. If you're diffing files, include the before and after files. If you're using difftastic with a VCS repository (e.g. git), include the URL and commit hash.

I can't share the files unfortunately.

(3) The version of difftastic you're using (see difft --version) and your operating system.

difft --version
Difftastic 0.56.1 (built with rustc 1.76.0)

difftastic/src/main.rs

Lines 601 to 610 in b3732b9

if exceeded_graph_limit {
let lhs_positions = line_parser::change_positions(lhs_src, rhs_src);
let rhs_positions = line_parser::change_positions(rhs_src, lhs_src);
(
FileFormat::TextFallback {
reason: "exceeded DFT_GRAPH_LIMIT".into(),
},
lhs_positions,
rhs_positions,
)

Should pull an ENV variable per this:

difftastic/src/options.rs

Lines 270 to 279 in b3732b9

.arg(
Arg::new("graph-limit").long("graph-limit")
.takes_value(true)
.value_name("LIMIT")
.help("Use a text diff if the structural graph exceed this number of nodes in memory.")
.default_value(formatcp!("{}", DEFAULT_GRAPH_LIMIT))
.env("DFT_GRAPH_LIMIT")
.validator(|s| s.parse::<usize>())
.required(false),
)

I need to figure out how to test it is taking my new value in fish.

K, got it working with one more zero, bumping it to 50 million, instead of 5 million.

set --export DFT_GRAPH_LIMIT 50000000

Note that DFT_GRAPH_LIMIT is proportional to the amount of memory used, so I don't want to 10x the default value here.

I think this is working as intended.