gitforge/services/repository
rgon c956dae73d feat: adds option to force overwrite new branch for /contents route (#12663)
Adds an option "force_overwrite_new_branch" when posting to
/repos/{owner}/{repo}/contents to modify multiple files in a repository.
When user provides both "branch" and "new_branch" options, and
"new_branch" already exists, the "force_overwrite_new_branch" option
allows the user to overwrite the existing branch. Under the hood this
amounts to a "git push --force".

[Issue #12600](https://codeberg.org/forgejo/forgejo/issues/12600)

### Tests for Go changes

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.
- [x] API swagger docs updated

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12663
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-06 16:45:57 +02:00
..
archiver
commitstatus chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
files feat: adds option to force overwrite new branch for /contents route (#12663) 2026-06-06 16:45:57 +02:00
gitgraph chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
adopt.go feat: replace repo based server-side hooks with centralised hooks (#10397) 2026-04-27 22:34:46 +02:00
adopt_test.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
avatar.go feat: serve downsized versions of avatars (#11242) 2026-05-16 12:04:05 +02:00
avatar_test.go
branch.go
cache.go
check.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
collaboration.go
collaboration_test.go
commit.go
contributors_graph.go
contributors_graph_test.go
create.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
create_test.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
delete.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
fork.go feat: replace repo based server-side hooks with centralised hooks (#10397) 2026-04-27 22:34:46 +02:00
fork_test.go
generate.go
generate_repo_commit.go fix: remove template file from generated repo (#11691) 2026-03-17 23:39:10 +01:00
generate_repo_commit_legacy.go fix: remove template file from generated repo (#11691) 2026-03-17 23:39:10 +01:00
generate_test.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
hooks.go feat: replace repo based server-side hooks with centralised hooks (#10397) 2026-04-27 22:34:46 +02:00
init.go
lfs.go
lfs_test.go fix test: revert unneeded test change with unintended consequences (#12281) 2026-04-27 23:05:18 +02:00
main_test.go
migrate.go feat: replace repo based server-side hooks with centralised hooks (#10397) 2026-04-27 22:34:46 +02:00
push.go chore: remove dead code in WatchIfAuto and general model documentation (#10880) 2026-01-26 12:03:08 +01:00
repository.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
repository_test.go fix: allow repository deletion when referenced by a repo-specific access token (#11927) 2026-04-01 16:05:20 +02:00
review.go
review_test.go
setting.go
star.go
sync_fork.go
template.go
transfer.go
transfer_test.go