Skip to content

Allow configuring fork push remote from CLI#14708

Merged
estib-vega merged 1 commit into
masterfrom
inspect-cli-fork-pr-flow
Jul 13, 2026
Merged

Allow configuring fork push remote from CLI#14708
estib-vega merged 1 commit into
masterfrom
inspect-cli-fork-pr-flow

Conversation

@estib-vega

@estib-vega estib-vega commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🧢 Changes

Adds --push-remote to but config target, validates the named remote, and routes target updates through the new workspace API.
Adds CLI parsing coverage and an API test for distinct upstream target and fork push remotes.

☕️ Reasoning

Fork contributors need to configure upstream/main as the review target while pushing branches to origin without first opening the desktop app.
Validated with focused tests, formatting, cargo check, and Clippy for but and but-api.

@estib-vega estib-vega force-pushed the inspect-cli-fork-pr-flow branch from 167ec7c to 7d2bef2 Compare July 13, 2026 09:04
@estib-vega estib-vega marked this pull request as ready for review July 13, 2026 09:04
Copilot AI review requested due to automatic review settings July 13, 2026 09:04
@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Jul 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring a separate push remote when setting the project target branch via but config target, enabling fork workflows (review against upstream/* while pushing to origin).

Changes:

  • Extends but config target CLI args with --push-remote and enforces that it can only be used when a target branch is provided.
  • Wires the new flag through the config command execution path to update project metadata (target ref + optional push remote).
  • Adds CLI parsing tests and an integration test asserting gitbutler.project.targetRef and gitbutler.project.pushRemote are set as expected.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
crates/but/tests/but/command/config.rs Adds an integration test verifying target and push-remote are stored distinctly for fork workflows.
crates/but/src/command/config.rs Threads --push-remote through config target handling and validates the named remote before updating metadata.
crates/but/src/args/tests.rs Adds argument-shape tests for config target --push-remote parsing and validation.
crates/but/src/args/config.rs Adds the --push-remote flag and CLI docs for fork push-remote configuration.

Comment thread crates/but/src/command/config.rs
Comment thread crates/but/src/command/config.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d2bef2b45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1886 to 1890
but_api::workspace::set_target_ref_and_init_project(
ctx,
new_branch.clone(),
None,
target_ref.as_ref(),
push_remote,
)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recompute the base when changing the target

When a repo already has gitbutler.project.targetCommitId and the user changes to a target whose merge-base differs, this now calls set_target_ref_and_init_project(), which preserves the existing target commit id instead of recomputing it. That leaves targetRef pointing at the new branch while base_sha/targetCommitId still comes from the old target, so target/status/integration calculations using ProjectMeta::target_commit_id operate against the wrong base; the previous set_base_branch path recomputed the merge-base for the requested branch.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

@estib-vega estib-vega enabled auto-merge July 13, 2026 09:20
@estib-vega estib-vega disabled auto-merge July 13, 2026 09:59
Copilot AI review requested due to automatic review settings July 13, 2026 10:08
@estib-vega estib-vega force-pushed the inspect-cli-fork-pr-flow branch from 7d2bef2 to 27b78fe Compare July 13, 2026 10:08
@estib-vega estib-vega force-pushed the inspect-cli-fork-pr-flow branch from 27b78fe to 7de9765 Compare July 13, 2026 10:08
@estib-vega estib-vega enabled auto-merge July 13, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment on lines +1880 to +1882
let target_ref: gix::refs::FullName = format!("refs/remotes/{new_branch}")
.try_into()
.context("Invalid target branch name")?;
Copilot AI review requested due to automatic review settings July 13, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 11:26
@estib-vega estib-vega force-pushed the inspect-cli-fork-pr-flow branch from 7de9765 to cd074f4 Compare July 13, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@estib-vega estib-vega merged commit aabff93 into master Jul 13, 2026
40 checks passed
@estib-vega estib-vega deleted the inspect-cli-fork-pr-flow branch July 13, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants