From bd7934ccbfe9b1040ee2d352b34d2b2b8093a5a8 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Fri, 1 Jul 2022 20:10:18 +0200 Subject: [PATCH] history: Refuse to merge in private mode It makes *no* sense. Fixes #9050. --- src/builtins/history.cpp | 6 ++++++ tests/checks/history.fish | 4 ++++ 2 files changed, 10 insertions(+) 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