Fix worktree creation handling
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -474,15 +474,16 @@ pub fn add_worktree(
|
||||
|
||||
let config = repo::read_worktree_root_config(directory)?;
|
||||
|
||||
let path = match subdirectory {
|
||||
Some(dir) => dir.join(name),
|
||||
None => Path::new(name).to_path_buf(),
|
||||
};
|
||||
|
||||
if repo.find_worktree(&path).is_ok() {
|
||||
if repo.find_worktree(&name).is_ok() {
|
||||
return Err(format!("Worktree {} already exists", &name));
|
||||
}
|
||||
|
||||
let path = match subdirectory {
|
||||
Some(dir) => directory.join(dir).join(name),
|
||||
None => directory.join(Path::new(name).to_path_buf()),
|
||||
};
|
||||
|
||||
let mut remote_branch_exists = false;
|
||||
|
||||
let default_checkout = || repo.default_branch()?.to_commit();
|
||||
|
||||
Reference in New Issue
Block a user