Diff between c0b61227ac9e536bebafc031dcdc81ab1ab34980 and 4f64816c83e6a6fd44e6dfdfac2fa58d78f7d1ac

Changed Files

File Additions Deletions Status
src/shared/shell.c +4 -1 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index cfdcc76..2e094b8 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -681,6 +681,7 @@ int bt_shell_release_prompt(const char *input)
 static void rl_handler(char *input)
 {
 	wordexp_t w;
+	HIST_ENTRY *last;
 
 	if (!input) {
 		rl_insert_text("quit");
@@ -696,7 +697,9 @@ static void rl_handler(char *input)
 	if (!bt_shell_release_prompt(input))
 		goto done;
 
-	if (history_search(input, -1))
+	last = history_get(history_length + history_base - 1);
+	/* append only if input is different from previous command */
+	if (!last || strcmp(input, last->line))
 		add_history(input);
 
 	if (data.monitor)