From c01daea32bc1767f9e3a6701d709144b37944ff5 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 2 Jun 2024 19:29:54 -0700 Subject: [PATCH] Revert "Fix duplicate pre-saving issue reported in #215" This reverts commit 336b331687eab623cdd19c02b391b20840c72153. --- client/lib/config.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/client/lib/config.sh b/client/lib/config.sh index 13c83e8..1454107 100644 --- a/client/lib/config.sh +++ b/client/lib/config.sh @@ -20,22 +20,9 @@ function __hishtory_precommand() { HISHTORY_START_TIME=`hishtory getTimestamp` CMD=`history 1` if ! [ -z "CMD " ] ; then - if [[ "$CMD" != "$LAST_PRESAVED_COMMAND" ]] ; then - (hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME &) # Background Run - # hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME # Foreground Run - fi + (hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME &) # Background Run + # hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME # Foreground Run fi - # This code with $LAST_PRESAVED_COMMAND is necessary to work around a quirk of bash. With bash, - # if you run the command `foo` and then press `Control+R`, it will trigger the DEBUG signal. And - # `history 1` will still return `foo` so this will lead to duplicate pre-saves causing entries to - # show up twice. This works around this issue by skipping presaving if the last commadn we presaved - # was identical. - # - # This does lead to a potential correctness bug since it means if someone runs the same non-terminating - # command twice in a row, we won't pre-save the second entry. But this seems reasonably unlikely - # such that it is worth accepting this issue to mitigate the duplicate entries observed in - # https://github.com/ddworken/hishtory/issues/215. - LAST_PRESAVED_COMMAND=$CMD } trap "__hishtory_precommand" DEBUG