Skip to content

Commit

Permalink
fix(tabby-git): normalize path separators for platform compatibility
Browse files Browse the repository at this point in the history
related: #3314
  • Loading branch information
wsxiaoys committed Oct 25, 2024
1 parent 41ca242 commit 2190c1f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/tabby-git/src/serve_git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ fn resolve<'a>(
rev: Option<&str>,
relpath_str: Option<&str>,
) -> anyhow::Result<Resolve<'a>> {
// relpath_str is always separated by `/`, need to process it into platform specific path (e.g `\` on windows).
let relpath_str = relpath_str.map(|s| s.replace('/', std::path::MAIN_SEPARATOR_STR));

let commit = rev_to_commit(repository, rev)?;
let tree = commit.tree()?;

let relpath = Path::new(relpath_str.unwrap_or(""));
let relpath = Path::new(relpath_str.as_deref().unwrap_or(""));
let object = if relpath_str.is_some() {
tree.get_path(relpath)?.to_object(repository)?
} else {
Expand Down

0 comments on commit 2190c1f

Please sign in to comment.