Stop rewriting the history file on every command

fish is designed to append to the history file in most cases. However
save_internal_via_appending was never returning success, so we were
always doing the slow rewrite path. Correctly return success.

Fixes #6042
This commit is contained in:
ridiculousfish 2019-08-15 13:44:27 -07:00
parent 7ab291775a
commit a87e0183df
2 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,7 @@
- `switch` now allows arguments that expand to nothing, like empty variables (#5677).
- The null command (:) now always exits successfully, rather than echoing last return code.
- Cursor configuration instructions for vi-mode have been added to the fish documentation.
- A bug caused fish to rewrite the history file on every command. This has been fixed: fish will append to the file in most cases (#6042).
### Syntax changes and new commands
- Brace expansion now only takes place if the braces include a "," or a variable expansion, so things like `git reset HEAD@{0}` now work (#5869).

View File

@ -947,6 +947,8 @@ bool history_impl_t::save_internal_via_appending() {
this->history_file_id = file_id_for_fd(history_fd);
close(history_fd);
ok = (err == 0);
}
// If someone has replaced the file, forget our file state.