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.
This commit is contained in:
Ellie Huxtable 2023-10-29 18:03:34 +00:00 committed by GitHub
parent bb438d8d59
commit 57a8db13c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {