-
Notifications
You must be signed in to change notification settings - Fork 985
Allow configuring fork push remote from CLI #14708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,10 @@ pub async fn exec( | |
| ) -> Result<()> { | ||
| match cmd { | ||
| Some(Subcommands::User { cmd }) => user_config(ctx, out, cmd).await, | ||
| Some(Subcommands::Target { branch }) => target_config(ctx, out, branch).await, | ||
| Some(Subcommands::Target { | ||
| branch, | ||
| push_remote, | ||
| }) => target_config(ctx, out, branch, push_remote).await, | ||
| Some(Subcommands::Forge { cmd }) => forge_config(out, cmd).await, | ||
| Some(Subcommands::Metrics { status }) => metrics_config(out, status).await, | ||
| Some(Subcommands::Ai { local, global, cmd }) => { | ||
|
|
@@ -1764,6 +1767,7 @@ async fn target_config( | |
| ctx: &mut Context, | ||
| out: &mut OutputChannel, | ||
| branch: Option<String>, | ||
| push_remote: Option<String>, | ||
| ) -> Result<()> { | ||
| let t = theme::get(); | ||
| match branch { | ||
|
|
@@ -1866,17 +1870,26 @@ async fn target_config( | |
| )?; | ||
| } | ||
|
|
||
| // from the new_branch string, we need to parse out the remote name and branch name | ||
| if let Some(push_remote) = push_remote.as_deref() { | ||
| ctx.repo | ||
| .get()? | ||
| .find_remote(push_remote) | ||
| .with_context(|| format!("Failed to find push remote '{push_remote}'"))?; | ||
| } | ||
|
|
||
| let target_ref: gix::refs::FullName = format!("refs/remotes/{new_branch}") | ||
| .try_into() | ||
| .context("Invalid target branch name")?; | ||
|
Comment on lines
+1880
to
+1882
|
||
| drop((guard, ws)); | ||
| cfg_if! { | ||
| if #[cfg(feature = "legacy")] { | ||
| drop((guard, ws)); | ||
| but_api::legacy::virtual_branches::set_base_branch( | ||
| but_api::workspace::set_target_ref_and_init_project( | ||
| ctx, | ||
| new_branch.clone(), | ||
| None, | ||
| target_ref.as_ref(), | ||
| push_remote, | ||
| )?; | ||
|
estib-vega marked this conversation as resolved.
Comment on lines
+1886
to
1890
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a repo already has Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to be encoded in a test. This should be fixed in another PR |
||
| } else { | ||
| anyhow::bail!("Cannot yet set the base-branch without legacy functions - needs port") | ||
| anyhow::bail!("Cannot yet set the target branch without legacy functions") | ||
| } | ||
| }; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.