0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-29 08:17:47 +01:00
gitea/routers/api/v1/repo
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>
2020-05-29 19:16:20 +01:00
..
blob.go Swagger info corrections (#9441) 2019-12-20 19:07:12 +02:00
branch.go Add API Endpoint for Branch Creation (#11607) 2020-05-29 19:16:20 +01:00
collaborators.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
commits.go Consolidate API for getting single commit (#11368) 2020-05-11 12:44:36 +03:00
file.go Fix GetContents(): Dont't ignore Executables (#11192) 2020-04-24 19:20:22 +03:00
fork.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
git_hook.go Swagger info corrections (#9441) 2019-12-20 19:07:12 +02:00
git_ref.go Swagger info corrections (#9441) 2019-12-20 19:07:12 +02:00
hook.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
hook_test.go API endpoint for testing webhook (#3550) 2018-04-29 14:21:33 +08:00
issue.go Make API EditIssue and EditPullRequest issue notifications (#11123) 2020-05-17 00:05:19 +03:00
issue_comment.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
issue_label.go Add Organization Wide Labels (#10814) 2020-04-01 01:14:46 -03:00
issue_reaction.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
issue_stopwatch.go Prevent panic in stopwatch (#10670) 2020-03-08 14:46:24 -03:00
issue_subscription.go Return issue subscription status from API subscribe (#10966) 2020-04-30 23:55:24 +01:00
issue_tracked_time.go Fix tracked time issues (#11349) 2020-05-09 11:18:44 -03:00
key.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
label.go Add Organization Wide Labels (#10814) 2020-04-01 01:14:46 -03:00
main_test.go API endpoint for testing webhook (#3550) 2018-04-29 14:21:33 +08:00
migrate.go Various fixes in login sources (#10428) 2020-02-23 13:52:05 -06:00
milestone.go Refactor Milestone related (#11225) 2020-05-12 22:54:35 +01:00
mirror.go Refactor api repo dir (#10048) 2020-01-29 13:55:23 +08:00
pull.go Make API EditIssue and EditPullRequest issue notifications (#11123) 2020-05-17 00:05:19 +03:00
pull_review.go Add default CommitID for create pull review api (#11334) 2020-05-08 19:50:23 +01:00
release.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
release_attachment.go Swagger info corrections (#9441) 2019-12-20 19:07:12 +02:00
repo.go Fix repo-list private and total count bugs (#11500) 2020-05-20 22:15:30 -03:00
repo_test.go Fixes #5960 - Adds API Endpoint for Repo Edit (#7006) 2019-05-30 11:09:05 -04:00
star.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
status.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
subscriber.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
tag.go [API] enable paggination for ListRepoTags (#10454) 2020-02-25 14:07:07 -05:00
topic.go API add/generalize pagination (#9452) 2020-01-24 14:00:29 -05:00
transfer.go API endpoint for repo transfer (#9947) 2020-01-31 15:49:04 +00:00
tree.go Swagger info corrections (#9441) 2019-12-20 19:07:12 +02:00