diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-10-29 18:03:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-29 18:03:34 +0000 |
commit | 57a8db13c23bb22161c27f447227cd24670ff2a2 (patch) | |
tree | a6cc22d9e2cda39e226543cd18ea56cfeedbc626 /atuin-client/src | |
parent | bb438d8d59b8c8032ba8210e08b8e96be9bf460f (diff) |
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.
Diffstat (limited to 'atuin-client/src')
-rw-r--r-- | atuin-client/src/database.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 2e4211aa..c4b45302 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 { |