history: Refuse to merge in private mode

It makes *no* sense.

Fixes #9050.
This commit is contained in:
Fabian Boehm 2022-07-01 20:10:18 +02:00
parent 80fe0a7fcb
commit bd7934ccbf
2 changed files with 10 additions and 0 deletions

View File

@ -305,6 +305,12 @@ maybe_t<int> builtin_history(parser_t &parser, io_streams_t &streams, const wcha
break; 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(); history->incorporate_external_changes();
break; break;
} }

View File

@ -66,3 +66,7 @@ builtin history -t merge
# Now do a history command that should succeed so we exit with a zero, # Now do a history command that should succeed so we exit with a zero,
# success, status. # success, status.
builtin history save builtin history save
set -g fish_private_mode 1
builtin history merge
#CHECKERR: history: can't merge history in private mode