Remove branch-namespace option
This commit is contained in:
@@ -94,12 +94,6 @@ pub struct WorktreeAddArgs {
|
||||
#[clap(about = "Name of the worktree")]
|
||||
pub name: String,
|
||||
|
||||
#[clap(
|
||||
short = 'n',
|
||||
long = "branch-namespace",
|
||||
about = "Namespace of the branch"
|
||||
)]
|
||||
pub branch_namespace: Option<String>,
|
||||
#[clap(short = 't', long = "track", about = "Remote branch to track")]
|
||||
pub track: Option<String>,
|
||||
|
||||
|
||||
@@ -157,13 +157,7 @@ fn main() {
|
||||
None => None,
|
||||
};
|
||||
|
||||
match grm::add_worktree(
|
||||
&cwd,
|
||||
&action_args.name,
|
||||
action_args.branch_namespace.as_deref(),
|
||||
track,
|
||||
action_args.no_track,
|
||||
) {
|
||||
match grm::add_worktree(&cwd, &action_args.name, track, action_args.no_track) {
|
||||
Ok(_) => print_success(&format!("Worktree {} created", &action_args.name)),
|
||||
Err(error) => {
|
||||
print_error(&format!("Error creating worktree: {}", error));
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -461,7 +461,6 @@ pub fn find_in_tree(path: &Path) -> Result<(Tree, Vec<String>), String> {
|
||||
pub fn add_worktree(
|
||||
directory: &Path,
|
||||
name: &str,
|
||||
branch_namespace: Option<&str>,
|
||||
track: Option<(&str, &str)>,
|
||||
no_track: bool,
|
||||
) -> Result<(), String> {
|
||||
@@ -478,11 +477,6 @@ pub fn add_worktree(
|
||||
return Err(format!("Worktree {} already exists", &name));
|
||||
}
|
||||
|
||||
let branch_name = match branch_namespace {
|
||||
Some(prefix) => format!("{}{}{}", &prefix, BRANCH_NAMESPACE_SEPARATOR, &name),
|
||||
None => name.to_string(),
|
||||
};
|
||||
|
||||
let mut remote_branch_exists = false;
|
||||
|
||||
let default_checkout = || repo.default_branch()?.to_commit();
|
||||
@@ -531,9 +525,9 @@ pub fn add_worktree(
|
||||
};
|
||||
}
|
||||
|
||||
let mut target_branch = match repo.find_local_branch(&branch_name) {
|
||||
let mut target_branch = match repo.find_local_branch(name) {
|
||||
Ok(branchref) => branchref,
|
||||
Err(_) => repo.create_branch(&branch_name, &checkout_commit)?,
|
||||
Err(_) => repo.create_branch(name, &checkout_commit)?,
|
||||
};
|
||||
|
||||
fn push(
|
||||
|
||||
Reference in New Issue
Block a user