Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: fully-qualify PathBuf in git.rs, drop dead stored_plugin_env

thinhlpg4824d8683a2c
diff --git a/.omp b/.omp
new file mode 120000
index 000000000..de18a59b1
--- /dev/null
+++ b/.omp
@@ -0,0 +1 @@
+/Users/thinhlpg/code/jan/.omp
\ No newline at end of file
diff --git a/src-tauri/src/core/agent/git.rs b/src-tauri/src/core/agent/git.rs
index dcd6925ff..4178e005e 100644
--- a/src-tauri/src/core/agent/git.rs
+++ b/src-tauri/src/core/agent/git.rs
@@ -23,9 +23,7 @@
//! ref. The user's `git status`, current branch, and staged changes are never
//! touched. Shelling out keeps us free of a libgit2 dependency.
-use std::path::Path;
-#[cfg(feature = "cli")]
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::process::Command;
@@ -148,7 +146,7 @@ pub(crate) fn current_branch(path: &Path) -> Option<String> {
/// `--git-common-dir` points at the shared `<main>/.git`; the main worktree
/// root is its parent. `--path-format=absolute` (git 2.31+) keeps the answer
/// usable no matter which cwd git would otherwise resolve against.
-pub(crate) fn worktree_primary_root(path: &Path) -> Option<PathBuf> {
+pub(crate) fn worktree_primary_root(path: &Path) -> Option<std::path::PathBuf> {
let p = path.to_string_lossy();
let common = git(&[
"-C",
diff --git a/src-tauri/src/core/agent/plugins.rs b/src-tauri/src/core/agent/plugins.rs
index bce58901f..81b09b575 100644
--- a/src-tauri/src/core/agent/plugins.rs
+++ b/src-tauri/src/core/agent/plugins.rs
@@ -272,16 +272,9 @@ fn plugin_env_path(dir: &Path, plugin: &str) -> Result<PathBuf, String> {
Ok(dir.join(format!("{stem}.toml")))
}
-/// The stored env values for one plugin. Missing or malformed file -> empty.
-#[cfg(feature = "cli")]
-pub(crate) fn stored_plugin_env(plugin: &str) -> std::collections::BTreeMap<String, String> {
- match plugin_env_dir() {
- Ok(dir) => stored_plugin_env_in(&dir, plugin),
- Err(_) => Default::default(),
- }
-}
-
-/// [`stored_plugin_env`] against an explicit directory (tests).
+/// The stored env values for one plugin, resolved against the real plugin-env
+/// store directory. Missing or malformed file -> empty.
+/// [`stored_plugin_env_in`] is the variant taking an explicit directory (tests).
pub(crate) fn stored_plugin_env_in(
dir: &Path,
plugin: &str,