forgejo_backup/routers/api/v1/repo
Earl Warren 7ec014cba8 fix: do not fail when release or wiki is set in /repos/migrate API (#8155)
* convert updateRepoUnits to not rely on ctx to retrieve the repo
* Add integration test
* do not activate releases if `wiki: true`. This is unexpected and there is no evidence it is necessary.

Refs https://codeberg.org/forgejo/forgejo/issues/8082

---

The test is minimal for the sake of backporting. It is verified to reproduce the bug if the fix is not present.

```sh
$ make TAGS='sqlite sqlite_unlock_notify' 'test-sqlite#TestAPIRepoMigrate'
...
=== TestAPIRepoMigrate (tests/integration/api_repo_test.go:388)
--- FAIL: TestAPIRepoMigrate (1.12s)
    testlogger.go:411: 2025/06/11 17:38:22 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/earl-warren/software/forgejo/tests/gitea-lfs-meta
    testlogger.go:411: 2025/06/11 17:38:22 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for test-mock:12345, 200 OK in 2.1ms @ auth/auth.go:145(auth.SignIn)
    testlogger.go:411: 2025/06/11 17:38:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for test-mock:12345, 303 See Other in 2.1ms @ auth/auth.go:179(auth.SignInPost)
    testlogger.go:411: 2025/06/11 17:38:22 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/settings/applications for test-mock:12345, 200 OK in 3.8ms @ setting/applications.go:25(setting.Applications)
    testlogger.go:411: 2025/06/11 17:38:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/settings/applications for test-mock:12345, 303 See Other in 5.1ms @ setting/applications.go:35(setting.ApplicationsPost)
    testlogger.go:411: 2025/06/11 17:38:22 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/settings/applications for test-mock:12345, 200 OK in 2.9ms @ setting/applications.go:25(setting.Applications)
    testlogger.go:411: 2025/06/11 17:38:23 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/v1/repos/migrate for test-mock:12345, 0  in 992.0ms @ repo/migrate.go:38(repo.Migrate)
    api_repo_test.go:400:
        	Error Trace:	/home/earl-warren/software/forgejo/tests/integration/api_repo_test.go:400
        	Error:      	Not equal:
        	            	expected: 201
        	            	actual  : 200
        	Test:       	TestAPIRepoMigrate
    api_repo_test.go:402:
        	Error Trace:	/home/earl-warren/software/forgejo/tests/integration/integration_test.go:649
        	            				/home/earl-warren/software/forgejo/tests/integration/api_repo_test.go:402
        	Error:      	Received unexpected error:
        	            	EOF
        	Test:       	TestAPIRepoMigrate
```

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- 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 added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

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

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Bug fixes
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/8155): <!--number 8155 --><!--line 0 --><!--description ZG8gbm90IGZhaWwgd2hlbiByZWxlYXNlIG9yIHdpa2kgaXMgc2V0IGluIGAvcmVwb3MvbWlncmF0ZWAgQVBJ-->do not fail when release or wiki is set in `/repos/migrate` API<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8155
Reviewed-by: Lucas <sclu1034@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-06-12 11:12:58 +02:00
..
action.go fix: rename api.{List,}ActionRun to api.{List,}RepoActionRun (#8066) 2025-06-04 07:09:06 +02:00
avatar.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
blob.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
branch.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
collaborators.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
commits.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
compare.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
download.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
file.go API: enforce sha requirement on POST /repos/{owner}/{repo}/contents (#8139) 2025-06-12 00:13:39 +02:00
flags.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
fork.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
git_hook.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
git_ref.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
hook.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
hook_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
issue.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_attachment.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_comment.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_comment_attachment.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_dependency.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
issue_label.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
issue_pin.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_reaction.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_stopwatch.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_subscription.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue_tracked_time.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
key.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
label.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
language.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
main_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
migrate.go fix: do not fail when release or wiki is set in /repos/migrate API (#8155) 2025-06-12 11:12:58 +02:00
milestone.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
mirror.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
notes.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
patch.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
pull.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
pull_review.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
release.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
release_attachment.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
release_tags.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo.go fix: do not fail when release or wiki is set in /repos/migrate API (#8155) 2025-06-12 11:12:58 +02:00
repo_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
star.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
status.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
subscriber.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
sync_fork.go feat: sync forks (#2364) 2025-04-07 07:00:38 +00:00
tag.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
teams.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
topic.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
transfer.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
tree.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
wiki.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00