forgejo/routers/api/v1
Gergely Nagy d87c526d2a
Allow changing the repo Wiki branch to main
Previously, the repo wiki was hardcoded to use `master` as its branch,
this change makes it possible to use `main` (or something else, governed
by `[repository].DEFAULT_BRANCH`, a setting that already exists and
defaults to `main`).

The way it is done is that a new column is added to the `repository`
table: `wiki_branch`. The migration will make existing repositories
default to `master`, for compatibility's sake, even if they don't have a
Wiki (because it's easier to do that). Newly created repositories will
default to `[repository].DEFAULT_BRANCH` instead.

The Wiki service was updated to use the branch name stored in the
database, and fall back to the default if it is empty.

Old repositories with Wikis using the older `master` branch will have
the option to do a one-time transition to `main`, available via the
repository settings in the "Danger Zone". This option will only be
available for repositories that have the internal wiki enabled, it is
not empty, and the wiki branch is not `[repository].DEFAULT_BRANCH`.

When migrating a repository with a Wiki, Forgejo will use the same
branch name for the wiki as the source repository did. If that's not the
same as the default, the option to normalize it will be available after
the migration's done.

Additionally, the `/api/v1/{owner}/{repo}` endpoint was updated: it will
now include the wiki branch name in `GET` requests, and allow changing
the wiki branch via `PATCH`.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-01-31 11:43:23 +01:00
..
activitypub More refactoring of db.DefaultContext (#27083) 2023-09-15 06:13:19 +00:00
admin [GITEA] Fix API inconsistencies 2024-01-28 11:05:33 +01:00
misc Always enable caches (#28527) 2023-12-19 09:29:05 +00:00
notify Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
org Add get actions runner registration token for API routes, repo, org, user and global level (#27144) 2023-12-27 07:57:54 +00:00
packages Another round of db.DefaultContext refactor (#27103) 2023-09-25 13:17:37 +00:00
repo Allow changing the repo Wiki branch to main 2024-01-31 11:43:23 +01:00
settings Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
shared [GITEA] API comment update routers/api/v1/shared/runners.go 2024-01-28 11:05:33 +01:00
swagger [GITEA] POST /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments 2024-01-28 10:58:28 +01:00
user [GITEA] Adjust name of operation 2024-01-28 11:05:33 +01:00
utils Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
api.go [GITEA] DELETE /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments/{comment} 2024-01-28 11:05:33 +01:00