Skip to content

fix(web): make the update button work on branches without tracking - #443

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/git-pull-no-upstream
Aug 7, 2026
Merged

fix(web): make the update button work on branches without tracking#443
ChuckBuilds merged 1 commit into
mainfrom
fix/git-pull-no-upstream

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

The report

From a pi's logs when using Update in the Tools tab:

git pull failed (returncode=1): There is no tracking information for the current branch.
Please specify which branch you want to rebase against.

The UI showed "Update failed; check logs for details" — the actual git message never reached the user, and there was no way to fix it without SSH.

A branch with no upstream is easy to land on: checking one out by name, restoring a backup, or following a guide that names a branch. Once there, the update button is permanently broken.

Fix

resolve_pull_command() decides how to pull:

state action
upstream set git pull --rebase (unchanged)
no upstream, origin/<branch> exists git pull --rebase origin <branch>, then attach tracking so next time is a plain pull
no upstream, no remote branch error naming the branch, pointing at Switch branch
detached HEAD says so

The resolution runs before the stash. Previously the handler stashed local changes and then found it couldn't pull — putting the user's work away for an update that was never going to happen.

Failures now surface git's own message rather than "check logs".

Branch picker

New GET /system/git-branches (local + remote-only) and a checkout_branch action, wired to a dropdown in the Tools tab. Switching attaches tracking, so Pull Latest works afterwards. The git panel now shows the tracking state up front, so the problem is visible before clicking Update.

Branch names are validated against a strict pattern before reaching a subprocess argument list.

Local edits

They block a checkout, as they should. Instead of a truncated one-liner, the response carries git's full list of blocking files plus can_retry_with_stash, and the UI offers "Stash and switch" as an explicit choice.

Stashing is never done unasked — putting someone's edits away without consent is worse than refusing the switch.

Verification

On the pi that produced the report (untracked audit branch):

  • update → Branch 'audit' has no upstream and there is no origin/audit to pull from. Use Switch branch…
  • git-infoupstream: '', can_pull: false
  • switch while dirty → refused, naming web_interface/blueprints/api_v3.py, can_retry_with_stash: true
  • {"branch": "evil;rm -rf /"}Invalid branch name

27 tests build real git repositories rather than mocking git, covering every path above — including the stash route, which couldn't be exercised safely on the device. Web suite: 229 passed, 1 skipped. New tests are picked up automatically by the full-tree CI invocation.

Reported from a pi whose checkout sat on a local branch:

    git pull failed (returncode=1): There is no tracking information for
    the current branch. Please specify which branch you want to rebase
    against.

The Tools tab reported that as "Update failed; check logs for details",
which tells the user nothing they can act on, and the underlying git
message never reached the UI at all.

A branch with no upstream is easy to end up on — checking one out by
name, restoring a backup, or following a guide that names a branch — and
until now it left the update button permanently broken with no way out
except SSH.

resolve_pull_command() now decides how to pull:
  - upstream set                  -> git pull --rebase, as before
  - no upstream, origin/<branch>  -> git pull --rebase origin <branch>,
    then attach tracking so the next update is a plain pull
  - no upstream, no remote branch -> an error naming the branch and
    pointing at Switch branch
  - detached HEAD                 -> says so, rather than failing obscurely

That resolution happens BEFORE the stash. Previously the handler stashed
local changes and then discovered it could not pull, putting the user's
work away for an update that was never going to run.

Failures now surface git's own message instead of "check logs".

Adds a branch picker to the Tools tab, backed by GET
/system/git-branches (local + remote-only) and a checkout_branch action.
Switching attaches tracking, so Pull Latest works afterwards. Branch
names are validated against a strict pattern before reaching a subprocess
argument list.

Local edits block a checkout, as they should. Rather than a truncated
one-line error, the response carries git's full list of blocking files
and a can_retry_with_stash flag; the UI then offers "Stash and switch" as
an explicit choice. Stashing is never done unasked — putting someone's
edits away without consent is worse than refusing the switch.

Verified on the pi that produced the report: on its untracked 'audit'
branch the update now returns the actionable message, git-info reports
upstream='' and can_pull=false, and an injected branch name is rejected.
27 tests build real git repositories and cover each path, including the
stash route that could not be exercised safely on the device.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ChuckBuilds, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cb2af088-71e0-4569-ad47-1566958442a6

📥 Commits

Reviewing files that changed from the base of the PR and between 31d607f and b3b3606.

📒 Files selected for processing (3)
  • test/test_git_pull_resolution.py
  • web_interface/blueprints/api_v3.py
  • web_interface/templates/v3/partials/tools.html

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds
ChuckBuilds merged commit fc25a70 into main Aug 7, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant