Skip to content

Branches still compare against previous default branch after switch #34369

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

Open
GWDx opened this issue May 5, 2025 · 0 comments · May be fixed by #34370
Open

Branches still compare against previous default branch after switch #34369

GWDx opened this issue May 5, 2025 · 0 comments · May be fixed by #34370
Labels
Milestone

Comments

@GWDx
Copy link

GWDx commented May 5, 2025

Description

Steps to reproduce

  1. Setup Test Repository
    • Locally create branches:
      • b1 (default) - 1 unique commit
      • b2 - 2 unique commits
      • b3 - 3 unique commits
        (All branches share the same base commit)
    • Push all branches to https://gitea.com/GWDx/bug-branch-divergence and verify b1 is the remote default branch
  2. Initial Verification
    Check branch divergence at: https://gitea.com/GWDx/bug-branch-divergence/branches
  3. Change Default Branch
    Navigate to repository settings: https://gitea.com/GWDx/bug-branch-divergence/settings/branches
    Switch default branch to b2
  4. Verify Bug
    Re-check branch comparisons at: https://gitea.com/GWDx/bug-branch-divergence/branches

Results

Step 2: With b1 as default branch, all branch comparisons work as expected.

Image

Step 4: After switching default branch to b2,

  • b1 correctly compares against b2 (new default)
  • b3 still incorrectly compares against b1 (old default)

Image

Expected Behavior

  • b3 should calculate divergence against b2 (current default)

Gitea Version

1.23.7

Can you reproduce the bug on the Gitea demo site?

Not yet. When executing Step 2, Gitea demo site seems down, returning HTTP 500.

Log Gist

No response

Screenshots

No response

Git Version

2.39.5

Operating System

Debian bookworm 6.1.0-34-amd64

How are you running Gitea?

I have validated this issue across multiple deployment methods:

  • Official Download
  • Build from source
  • Gitea Cloud Instance: Reproduced on https://gitea.com

Database

SQLite

@GWDx GWDx added the type/bug label May 5, 2025
GWDx added a commit to GWDx/gitea that referenced this issue May 5, 2025
Issue: After switching the default branch, other branches are still compared against the old default branch due to outdated divergence cache.

Change: Clear the divergence cache in SetRepoDefaultBranch to ensure correct comparisons against the new default branch.

Fixes go-gitea#34369
GWDx added a commit to GWDx/gitea that referenced this issue May 5, 2025
Issue: After switching the default branch, other branches are still compared against the old default branch due to outdated divergence cache.

Change: Clear the divergence cache in SetRepoDefaultBranch to ensure correct comparisons against the new default branch.

Fixes go-gitea#34369
@lunny lunny added this to the 1.24.0 milestone May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants