* Migration failure during reaction migration from gitea (#13344)
* Migrating reactions is just not that important
A failure during migrating reactions should not cause failure of
migration.
Signed-off-by: Andrew Thornton <[email protected]>
* When checking issue reactions check the correct permission
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
* Delete gitea_downloader.go
* Backport #13349
Unfortunately my final push to #13344 didn't register - or I failed to push it properly. GetIssueCommentReactions in routers/api/v1/repo/issue_reaction.go also makes the same mistake.
Co-authored-by: zeripath <[email protected]>
* Remove obsolete change of email on profile page
The change email on the account profile page is out-of-date
and unnecessary.
Changing email should be done using the account page.
Fix#13336
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: zeripath <[email protected]>
Backport #13249
* Fix initial commit page
Unfortunately as a result of properly fixing ParsePatch the hack that
used git show <initial_commit_id> to get the diff for this failed.
This PR fixes this using the "super-secret" empty tree ref to make the
diff against.
Signed-off-by: Andrew Thornton <[email protected]>
* Also fix#13248
Signed-off-by: Andrew Thornton <[email protected]>
* Update services/gitdiff/gitdiff.go
Co-authored-by: 6543 <[email protected]>
Co-authored-by: 6543 <[email protected]>
* Fix diff skipping lines
Backport #13154
ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.
This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.
This PR also fixes several issues with incomplete files.
Fix https://codeberg.org/Codeberg/Community/issues/308Fix#13153
Signed-off-by: Andrew Thornton <[email protected]>
* Add testcase
Signed-off-by: Andrew Thornton <[email protected]>
* fix comment
* simplify error handling
Signed-off-by: Andrew Thornton <[email protected]>
* never return io.EOF
Signed-off-by: Andrew Thornton <[email protected]>
Backport #13136
it is possible to have an ambiguous line here.
if they needed to be and if one was quoted then both would be.
Both of these were wrong.
I have now discovered `--src-prefix` and `--dst-prefix` which
means that we can set this in such a way to force the git diff
to always be unambiguous.
Therefore this PR rollsback most of the changes in #12771 and
uses these options to fix this.
Signed-off-by: Andrew Thornton <[email protected]>
* Prohibit automatic downgrades
* do not only log, print to stderr too
* Update models/migrations/migrations.go
* Update models/migrations/migrations.go
Co-authored-by: Cirno the Strongest <[email protected]>
* a nit
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Cirno the Strongest <[email protected]>
Backport #13096
If there is a panic during runMigrateTask we should capture and log the underlying
panic error.
This PR ensures that the panic is logged and captured as part of the task message.
Fix#13095
Signed-off-by: Andrew Thornton <[email protected]>
Backport #13092
`models.getUserRepoPermission(...)` calls `HasOrgVisible` which
uses `models.x` potentially outside of the transaction `e` provided
as an argument to `getUserRepoPermission`.
This PR switches to use `hasOrgVisible(e, ...)`.
Fix#12983
Signed-off-by: Andrew Thornton <[email protected]>
If a README file is a symlink to a submodule Gitea the view branch page
will return a 500.
The underlying problem is a missed conversion of an
plumbing.ErrObjectNotFound in git/tree_blob.go.
Fix#12599
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
* allow U2F with default settings for gitea in subpath
* use trim suffix
Co-authored-by: zeripath <[email protected]>
Co-authored-by: zeripath <[email protected]>
* Prevent empty div when editing comment
The template for attachments needs to remove whitespace and return empty when there are no attachments.
Fix#10220
Co-authored-by: zeripath <[email protected]>
Backport #12577
When adding Avatar email-hash pairs we simply want the DB table to
represent a Set. We don't care if the hash-pair is already present,
so we just simply Insert and ignore the error.
Unfortunately this seems to cause some DBs to log the duplicate
insert to their logs - looking like a bug a in Gitea.
Now, there is no standard way in SQL to say Insert but if there's
an error ignore it. MySQL has INSERT IGNORE, PostgreSQL >= 9.5 has
INSERT ... ON CONFLICT DO NOTHING, but I do not believe that SQLite
or MSSQL have variants.
This PR places the insert in a transaction which we are happy to fail
if there is an error - hopefully this will stop the unnecessary
logging.
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Backport #12900
We should only update is_empty, default_branch and updated time columns
during commitRepoAction and not update other columns as we risk
overwriting incorrect information.
Fix#11823Fix#10536
Signed-off-by: Andrew Thornton <[email protected]>
* Convert User expose ID each time (#12855)
* git blame tells me a lot of gitea things happen here around 2018, add header
* move user code int its own file
* expose user id
* adopt things from APIFormat
* fix test
* CI.restart()
* No Refactor
* CI.restart()
Co-authored-by: Lunny Xiao <[email protected]>
Backport #12622
* Escape more things that are passed through str2html
Signed-off-by: Andrew Thornton <[email protected]>
* Bloody editors!
Co-authored-by: mrsdizzie <[email protected]>
* Update routers/user/oauth.go
* On Migration respect old DefaultBranch
* add DefaultBranch int test set
Co-authored-by: zeripath <[email protected]>
Co-authored-by: zeripath <[email protected]>
Backport #12771
Following further testing it has become apparent that the diff line
cannot be used to determine filenames for diffs with any sort of predictability
the answer therefore is to use the other lines that are provided with a diff
Fix#12768
Signed-off-by: Andrew Thornton <[email protected]>
Make it possible to compile the default location of StaticRootPath independent from AppWorkPath
Co-authored-by: Andrew Thornton <[email protected]>
Co-authored-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>