WIP: Note about branch prefixes

This commit is contained in:
2022-02-21 19:43:35 +01:00
parent 44a716248e
commit 4c82f42c2a

View File

@@ -579,6 +579,12 @@ pub fn add_worktree(
} else { } else {
let remote_branch_name = match track_config.default_remote_prefix { let remote_branch_name = match track_config.default_remote_prefix {
Some(prefix) => { Some(prefix) => {
repo.set_config_push(GitPushDefaultSetting::Upstream)?;
if repo.remotes()?.len() > 1 {
println!("Warning: You are using branch prefixes together with multiple remotes. This will have a few unexpected effects. When pushing to your non-default remote, you will always have to add a refspec explicitly, like so: git push myremote master. See TODO DOCLINK for more details")
}
format!("{}{}{}", &prefix, BRANCH_NAMESPACE_SEPARATOR, &name) format!("{}{}{}", &prefix, BRANCH_NAMESPACE_SEPARATOR, &name)
} }
None => name.to_string(), None => name.to_string(),