diff --git a/src/builtins/history.cpp b/src/builtins/history.cpp index e6b6bbe43..2f43cc5c4 100644 --- a/src/builtins/history.cpp +++ b/src/builtins/history.cpp @@ -305,6 +305,12 @@ maybe_t builtin_history(parser_t &parser, io_streams_t &streams, const wcha break; } + if (in_private_mode(parser.vars())) { + streams.err.append_format( + _(L"%ls: can't merge history in private mode\n"), cmd); + status = STATUS_INVALID_ARGS; + break; + } history->incorporate_external_changes(); break; } diff --git a/tests/checks/history.fish b/tests/checks/history.fish index 7afe35b60..53a62d463 100644 --- a/tests/checks/history.fish +++ b/tests/checks/history.fish @@ -66,3 +66,7 @@ builtin history -t merge # Now do a history command that should succeed so we exit with a zero, # success, status. builtin history save + +set -g fish_private_mode 1 +builtin history merge +#CHECKERR: history: can't merge history in private mode