fix: restore_worktree()路径问题

This commit is contained in:
mrbeanc
2023-12-23 00:37:41 +08:00
parent ce2251fff6
commit 6d6fdd8bf2
2 changed files with 3 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ enum Command {
source: Option<String>,
/// worktree
#[clap(long, short, action)]
#[clap(long, short = 'W', action)]
worktree: bool,
/// staged

View File

@@ -19,9 +19,9 @@ pub fn restore_worktree(filter: Option<&Vec<PathBuf>>, target_blobs: &Vec<(PathB
};
let paths = util::integrate_paths(&paths); // file paths
let target_blobs = target_blobs // 转为对路径(cur_dir) 与filter统一 //TODO tree改变路径表示方式后这里需要修改
let target_blobs = target_blobs // 转为对路径 //TODO tree改变路径表示方式后这里需要修改
.iter()
.map(|(path, hash)| (util::to_workdir_relative_path(path), hash.clone()))
.map(|(path, hash)| (util::to_workdir_absolute_path(path), hash.clone()))
.collect::<Vec<(PathBuf, Hash)>>();
let index = Index::new();