From 57a8db13c23bb22161c27f447227cd24670ff2a2 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 29 Oct 2023 18:03:34 +0000 Subject: [PATCH] fix: initial list of history in workspace mode (#1356) The initial list didn't correctly show all history while in workspace mode, while it worked totally as expected while searching. Fix this. --- atuin-client/src/database.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 2e4211a..c4b4530 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -268,12 +268,18 @@ impl Database for Sqlite { query.and_where_is_null("deleted_at"); } + let git_root = if let Some(git_root) = context.git_root.clone() { + git_root.to_str().unwrap_or("/").to_string() + } else { + context.cwd.clone() + }; + match filter { FilterMode::Global => &mut query, FilterMode::Host => query.and_where_eq("hostname", quote(&context.hostname)), FilterMode::Session => query.and_where_eq("session", quote(&context.session)), FilterMode::Directory => query.and_where_eq("cwd", quote(&context.cwd)), - FilterMode::Workspace => query.and_where_like_any("cwd", context.cwd.clone()), + FilterMode::Workspace => query.and_where_like_left("cwd", git_root), }; if unique {