You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/modules/structs
Terence Le Huu Phuong 141d52cc0f
Add API Endpoint for Branch Creation (#11607)
* [FEATURE] [API] Add Endpoint for Branch Creation

Issue: https://github.com/go-gitea/gitea/issues/11376

This commit introduces an API endpoint for branch creation.

The added route is POST /repos/{owner}/{repo}/branches.
A JSON with the name of the new branch and the name of the old branch is
required as parameters.

Signed-off-by: Terence Le Huu Phuong <terence@qwasar.io>

* Put all the logic into CreateBranch and removed CreateRepoBranch

* - Added the error ErrBranchDoesNotExist in error.go
- Made the CreateNewBranch function return an errBranchDoesNotExist error
when the OldBranch does not exist
- Made the CreateBranch API function checks that the repository is not
empty and that branch exists.

* - Added a resetFixtures helper function in integration_test.go to
fine-tune test env resetting
- Added api test for CreateBranch
- Used resetFixture instead of the more general prepareTestEnv in the
repo_branch_test CreateBranch tests

* Moved the resetFixtures call inside the loop for APICreateBranch function

* Put the prepareTestEnv back in repo_branch_test

* fix import order/sort api branch test

Co-authored-by: zeripath <art27@cantab.net>
4 years ago
..
admin_user.go Move sdk structs to modules/structs (#6905) 5 years ago
attachment.go Fix wrong hint when status checking is running on pull request view (#9886) 5 years ago
commit_status.go Fix wrong hint when status checking is running on pull request view (#9886) 5 years ago
doc.go Move sdk structs to modules/structs (#6905) 5 years ago
fork.go Move sdk structs to modules/structs (#6905) 5 years ago
git_blob.go Move sdk structs to modules/structs (#6905) 5 years ago
git_hook.go Move sdk structs to modules/structs (#6905) 5 years ago
hook.go Granular webhook events (#9626) 4 years ago
issue.go [API] expose RepoOwner on Issue responce (#10126) 5 years ago
issue_comment.go Display original author and URL information when showing migrated issues/comments (#7352) 5 years ago
issue_label.go [API] Fix inconsistent label color format (#10129) 4 years ago
issue_milestone.go Move sdk structs to modules/structs (#6905) 5 years ago
issue_reaction.go [API] Fix 9544 | return 200 when reaction already exist (#9550) 5 years ago
issue_stopwatch.go [API] extend StopWatch (#9196) 5 years ago
issue_tracked_time.go [API] Extend times API (#9200) 5 years ago
lfs_lock.go Move sdk structs to modules/structs (#6905) 5 years ago
miscellaneous.go API method to list all commits of a repository (#6408) 5 years ago
notifications.go [API] add endpoint to check notifications [Extend #9488] (#9595) 5 years ago
org.go Add teams to repo on collaboration page. (#8045) 5 years ago
org_member.go Move sdk structs to modules/structs (#6905) 5 years ago
org_team.go [API] orgEditTeam make Fields optional (#9556) 5 years ago
org_type.go Fixes #7023 - API Org Visibility (#7028) 5 years ago
pull.go Fix API deadline removal (#8759) 5 years ago
pull_review.go API: Add pull review endpoints (#11224) 4 years ago
release.go Add single release page and latest redirect (#11102) 4 years ago
repo.go Add API Endpoint for Branch Creation (#11607) 4 years ago
repo_branch.go Prevent merge of outdated PRs on protected branches (#11012) 4 years ago
repo_collaborator.go Move sdk structs to modules/structs (#6905) 5 years ago
repo_commit.go [API] Extend contents with dates (#9464) 5 years ago
repo_file.go [API] Extend contents with dates (#9464) 5 years ago
repo_key.go Move sdk structs to modules/structs (#6905) 5 years ago
repo_refs.go Move sdk structs to modules/structs (#6905) 5 years ago
repo_tag.go Fixes #2738 - Adds the /git/tags API endpoint (#7138) 5 years ago
repo_topic.go Add API endpoint for accessing repo topics (#7963) 5 years ago
repo_tree.go Move sdk structs to modules/structs (#6905) 5 years ago
repo_watch.go Move sdk structs to modules/structs (#6905) 5 years ago
status.go Move sdk structs to modules/structs (#6905) 5 years ago
task.go Move migrating repository from frontend to backend (#6200) 5 years ago
user.go Add LastLogin to the User API (#7196) 5 years ago
user_app.go Remove Unused Functions (#10516) 4 years ago
user_email.go Move sdk structs to modules/structs (#6905) 5 years ago
user_gpgkey.go Move sdk structs to modules/structs (#6905) 5 years ago
user_key.go Move sdk structs to modules/structs (#6905) 5 years ago