Skip to content

fix(git): retry non-fast-forward update errors#6207

Merged
markphelps merged 4 commits into
flipt-io:v2from
jgaul3:jg/fix-non-fast-forward-retry
Jul 15, 2026
Merged

fix(git): retry non-fast-forward update errors#6207
markphelps merged 4 commits into
flipt-io:v2from
jgaul3:jg/fix-non-fast-forward-retry

Conversation

@jgaul3

@jgaul3 jgaul3 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

I've been frustrated trying to work with multiple branches in one go. Starting two branches and merging one meant that the other had unfixable resource type "flipt.core.Segment": non-fast-forward update: refs/heads/flipt/prod/branch-name errors.

Looking into it, I think that UpdateAndPush errors out when it should instead try a quick rebase to see whether the error goes away in this case. This PR adds in that check and retry logic as well as adds in a test to try and reproduce the error.

I've checked that the test fails without the update code, but eyes on this change are greatly appreciated 🙏

@jgaul3
jgaul3 requested a review from a team as a code owner July 14, 2026 06:24
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.46988% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.27%. Comparing base (028f10f) to head (02fd9ff).

Files with missing lines Patch % Lines
internal/storage/git/repository.go 67.46% 14 Missing and 13 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #6207      +/-   ##
==========================================
+ Coverage   54.80%   62.27%   +7.46%     
==========================================
  Files         145      145              
  Lines       18491    14815    -3676     
==========================================
- Hits        10134     9226     -908     
+ Misses       7609     4829    -2780     
- Partials      748      760      +12     
Flag Coverage Δ
integrationtests 33.50% <31.32%> (+1.59%) ⬆️
unittests 53.85% <67.46%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions 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.

Verdict: approve

Clean fix — correctly fetches on non-fast-forward, re-runs the change callback against an updated filesystem, and re-pushes. Both normal-repo and bare-repo shallow cases are tested. No issues found.

🤖 Automated review by the Flipt PR review agent.

Comment thread internal/storage/git/repository.go Outdated

@erka erka 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.

thanks @jgaul3

@markphelps
markphelps merged commit 46b0463 into flipt-io:v2 Jul 15, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants