mirror of
https://github.com/nushell/nushell.git
synced 2026-11-22 17:27:05 +08:00
Fixes #18321 Right now `history session` prints `0` if you call it from your config file, and only starts returning the real id once the REPL is up. The session id was created when the line editor was built, which happens after the startup config is evaluated. This moves session id creation to the very start of `run_repl`, before the config file runs, and reuses that same id when history gets set up. So `history session` is stable and correct from initialization through the whole session. I checked that the id is still only handed to the history backend and the editor when `history.isolation` is on, so history behavior itself is unchanged. Repro (before): ``` # config.nu $env.config.history.isolation = true print $"session: (history session)" ``` printed `session: 0` at startup, then the real id at the first prompt. After the fix both print the same nonzero id (verified with isolation on and off). Tests: - `cargo test -p nu-cli --lib` : 171 passed, including 2 new regression tests (`setup_history_reuses_startup_session_id`, `setup_history_keeps_startup_session_id_without_isolation`) plus the existing `are_session_ids_in_sync` - `cargo test -p nu-cli --features sqlite --test tests -- history` : 12 passed - `cargo clippy -p nu-cli --all-targets` and `cargo clippy --bin nu --all-targets` : clean - `cargo fmt --all -- --check` : clean
31 lines
564 B
Rust
31 lines
564 B
Rust
mod test_alias;
|
|
mod test_bits;
|
|
mod test_cell_path;
|
|
mod test_closures;
|
|
mod test_commandline;
|
|
mod test_conditionals;
|
|
mod test_config;
|
|
mod test_config_path;
|
|
mod test_converters;
|
|
mod test_custom_commands;
|
|
mod test_engine;
|
|
mod test_env;
|
|
mod test_help;
|
|
mod test_hiding;
|
|
mod test_history_session;
|
|
mod test_ide;
|
|
mod test_iteration;
|
|
mod test_known_external;
|
|
mod test_math;
|
|
mod test_modules;
|
|
mod test_parser;
|
|
mod test_ranges;
|
|
mod test_regex;
|
|
mod test_signatures;
|
|
mod test_spread;
|
|
mod test_stdlib;
|
|
mod test_strings;
|
|
mod test_table_operations;
|
|
mod test_type_check;
|
|
mod tests;
|