mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 12:21:19 -03:00
don't import bash history if not default fish hist
Don't import the bash history if the user has specified that a non-default fish history file should be used. Also, rename the var that specifies the fish history session ID from `FISH_HISTFILE` to `FISH_HISTORY`. Fixes #4172
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# vim: set filetype=expect:
|
||||
# We're going to use three history files, including the default, to verify
|
||||
# that the FISH_HISTFILE variable works as expected.
|
||||
# that the FISH_HISTORY variable works as expected.
|
||||
set default_histfile "../test/data/fish/fish_history"
|
||||
set my_histfile "../test/data/fish/my_history"
|
||||
set env_histfile "../test/data/fish/env_history"
|
||||
|
||||
# =============
|
||||
# Verify that if we spawn fish with no FISH_HISTFILE env var it uses the
|
||||
# Verify that if we spawn fish with no FISH_HISTORY env var it uses the
|
||||
# default file.
|
||||
# =============
|
||||
set fish_pid [spawn $fish]
|
||||
@@ -34,7 +34,7 @@ expect_prompt -re "\r\n$hist_line\r\n" {
|
||||
# history file is not written to.
|
||||
set cmd2 "echo $fish_pid my histfile"
|
||||
set hist_line "- cmd: $cmd2"
|
||||
send "set FISH_HISTFILE my\r"
|
||||
send "set FISH_HISTORY my\r"
|
||||
expect_prompt
|
||||
send "$cmd2\r"
|
||||
expect_prompt
|
||||
@@ -62,7 +62,7 @@ expect_prompt -re "\r\n$hist_line\r\n" {
|
||||
# Switch back to the default history file.
|
||||
set cmd3 "echo $fish_pid default histfile again"
|
||||
set hist_line "- cmd: $cmd3"
|
||||
send "set FISH_HISTFILE default\r"
|
||||
send "set FISH_HISTORY default\r"
|
||||
expect_prompt
|
||||
send "$cmd3\r"
|
||||
expect_prompt
|
||||
@@ -94,15 +94,15 @@ expect_prompt -re "\r\n$hist_line\r\n" {
|
||||
send "exit\r"
|
||||
close $spawn_id
|
||||
|
||||
# Set the FISH_HISTFILE env var.
|
||||
set ::env(FISH_HISTFILE) env
|
||||
# Set the FISH_HISTORY env var.
|
||||
set ::env(FISH_HISTORY) env
|
||||
|
||||
# Spawn a new shell.
|
||||
set prompt_counter 1
|
||||
set fish_pid [spawn $fish]
|
||||
expect_prompt
|
||||
|
||||
# Verify that the new fish shell is using the FISH_HISTFILE value for history.
|
||||
# Verify that the new fish shell is using the FISH_HISTORY value for history.
|
||||
set cmd4 "echo $fish_pid env histfile"
|
||||
set hist_line "- cmd: $cmd4"
|
||||
send "$cmd4\r"
|
||||
|
||||
Reference in New Issue
Block a user