From a87e0183df1c88c6c57c3f0897e8ee40f9950ae7 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 15 Aug 2019 13:44:27 -0700 Subject: [PATCH] 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 --- CHANGELOG.md | 1 + src/history.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ecf562eb..16a8b05d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/src/history.cpp b/src/history.cpp index e69ddd643..151aff6f0 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -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.