Skip to content

test: check contents API updates stack on an existing branch - #8557

Merged
unknwon merged 3 commits into
mainfrom
fix-contents-api-existing-branch
Nov 17, 2026
Merged

unknwon merged 3 commits into
mainfrom
fix-contents-api-existing-branch

Conversation

@unknwon

@unknwon unknwon commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Describe the pull request

The contents API always committed on top of the default branch and passed the requested branch as a new branch, so the first PUT to a non-default branch created it and every later one failed with branch already exists (500).

The fix itself, committing on top of the requested branch when it exists and still creating it from the default branch otherwise, landed in #8651 together with an integration test that only checked the status codes. This pull request adds the CHANGELOG entry and makes that test also check that the second update is on top of the first, that the branch has the latest content, and that the default branch is unchanged. It also credits @ifer47, who found and fixed the same bug in #8365.

Link to the issue: Fixes #8189

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan.
  • I have added an entry to CHANGELOG.

Test plan

  1. go test -run TestAPIV1Contents ./integration-tests/... against PostgreSQL passes.
  2. With the fix reverted, the existing branch subtest fails with branch already exists (500) on the second PUT.

@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from 4d01b1d to 7f4df53 Compare November 15, 2026 02:17
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from 95faa6e to c691980 Compare November 15, 2026 02:58
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from c691980 to 51f6db9 Compare November 15, 2026 03:40
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from 51f6db9 to 5a73067 Compare November 15, 2026 04:06
@unknwon
unknwon force-pushed the api-v1-flamego branch 4 times, most recently from 99ddadc to 2d00e7b Compare November 15, 2026 05:34
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from 5a73067 to cc33445 Compare November 15, 2026 13:45
@unknwon
unknwon force-pushed the api-v1-flamego branch 2 times, most recently from 9de21d4 to 1ca8dee Compare November 15, 2026 14:30
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from cc33445 to 9db8989 Compare November 15, 2026 14:36
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from 9db8989 to fd5c293 Compare November 15, 2026 19:00
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from fd5c293 to 2f99add Compare November 15, 2026 22:21
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch 2 times, most recently from ac50630 to bb14e24 Compare November 16, 2026 00:46
@unknwon
unknwon force-pushed the api-v1-flamego branch 2 times, most recently from 77bf58f to da5e771 Compare November 16, 2026 01:45
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch 3 times, most recently from d4164cb to a7254cd Compare November 16, 2026 03:07
Base automatically changed from api-v1-flamego to main November 17, 2026 01:50
@mintlify

mintlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Gogs 🟢 Ready View Preview Nov 17, 2026, 6:40 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

unknwon and others added 3 commits November 17, 2026 06:35
The contents API always committed on top of the default branch and treated the
requested branch as a new one, so a second update on the same branch failed
because the branch already existed. It now commits on top of the requested
branch when it exists.
ifer47 found and fixed the same bug in #8365.

Co-authored-by: ifer47 <[email protected]>
The second update on a branch is on top of the first, the branch has the
latest content, and the default branch is unchanged.
@unknwon
unknwon force-pushed the fix-contents-api-existing-branch branch from a7254cd to 1488f8d Compare November 17, 2026 06:40
@unknwon unknwon changed the title api: update files on an existing branch through the contents API test: check contents API updates stack on an existing branch Nov 17, 2026
@unknwon
unknwon merged commit 2f9c4ec into main Nov 17, 2026
12 checks passed
@unknwon
unknwon deleted the fix-contents-api-existing-branch branch November 17, 2026 06:44

This branch was successfully deployed

1 active deployment
staging - docs — 1488f8db Deployed Nov 17, 2026 by mintlify[bot]
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.

Can't PUT again to non-master branch via API

1 participant