forked from gitea/gitea
1
0
Fork 0
gitea/routers/web/repo
zeripath 6fc73a8433
Fix compare link in active feeds for new branch (#19149) (#19185)
Backport #19149

When a new branch is pushed the old SHA is always listed as the empty sha and thus the compare link that is created does not work correctly.

Therefore when creating the compare link for new branches:

1. Attempt to get the parent of the first commit and use that as the basis
for the compare link.
2. If this is not possible make a comparison to the default branch
3. Finally if that is not possible simply do not show a compare link.

However, there are multiple broken compare links remaining therefore, in order for these to not break we will simply make the compare link redirect to the default branch.

Fix #19144

Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
2022-03-23 19:04:50 +00:00
..
activity.go Move unit into models/unit/ (#17576) 2021-11-09 20:57:58 +01:00
attachment.go Move attachment into models/repo/ (#17650) 2021-11-19 21:39:57 +08:00
blame.go Add warning for BIDI characters in page renders and in diffs (#17562) 2022-01-07 02:18:52 +01:00
branch.go Handle missing default branch better in owner/repo/branches page (#18290) 2022-01-16 22:59:16 +08:00
commit.go Collaborator trust model should trust collaborators (#18539) (#18557) 2022-02-03 11:20:37 -05:00
compare.go Fix compare link in active feeds for new branch (#19149) (#19185) 2022-03-23 19:04:50 +00:00
download.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
editor.go Stop trimming preceding and suffixing spaces from editor filenames (#18334) 2022-01-19 21:03:15 +00:00
editor_test.go Decouple unit test code from business code (#17623) 2021-11-12 22:36:47 +08:00
http.go Fix the bug: deploy key with write access can not push (#19010) (#19182) 2022-03-23 13:44:41 +00:00
http_test.go Fix http path bug (#16117) 2021-06-09 14:53:12 +02:00
issue.go Use the new/choose link for New Issue on project page (#19172) (#19176) 2022-03-23 09:41:12 +08:00
issue_content_history.go Show fullname on issue edits and gpg/ssh signing info (#18828) 2022-02-20 21:47:17 +00:00
issue_dependency.go Rename context.Query to context.Form (#16562) 2021-07-29 03:42:15 +02:00
issue_label.go Use a standalone struct name for Organization (#17632) 2021-11-19 19:41:40 +08:00
issue_label_test.go Decouple unit test, remove intermediate `unittestbridge` package (#17662) 2021-11-16 16:53:21 +08:00
issue_lock.go Refactor routers directory (#15800) 2021-06-09 01:33:54 +02:00
issue_stopwatch.go Multiple Escaping Improvements (#17551) 2021-11-16 18:18:25 +00:00
issue_test.go A better go code formatter, and now `make fmt` can run in Windows (#17684) 2021-11-17 20:34:35 +08:00
issue_timetrack.go Refactor routers directory (#15800) 2021-06-09 01:33:54 +02:00
issue_watch.go Refactor routers directory (#15800) 2021-06-09 01:33:54 +02:00
lfs.go Fix lfs bug (#19072) (#19080) 2022-03-14 15:59:54 +01:00
main_test.go Decouple unit test code from business code (#17623) 2021-11-12 22:36:47 +08:00
middlewares.go Move user related model into models/user (#17781) 2021-11-24 17:49:20 +08:00
migrate.go Unify and simplify TrN for i18n (#18141) 2022-01-02 04:33:57 +01:00
milestone.go Only view milestones from current repo (#18414) (#18417) 2022-01-26 22:09:07 +00:00
projects.go Removed unused method. (#18129) 2021-12-30 11:56:12 +08:00
projects_test.go Decouple unit test code from business code (#17623) 2021-11-12 22:36:47 +08:00
pull.go Always set PullRequestWorkInProgressPrefixes in PrepareViewPullInfo (#18713) (#18737) 2022-02-12 12:55:34 +00:00
pull_review.go Rename ctx.Form() to ctx.FormString() and move code into own file (#16571) 2021-08-11 02:31:13 +02:00
release.go Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069) 2022-01-05 13:17:25 +01:00
release_test.go Decouple unit test, remove intermediate `unittestbridge` package (#17662) 2021-11-16 16:53:21 +08:00
repo.go Unify and simplify TrN for i18n (#18141) 2022-01-02 04:33:57 +01:00
search.go Related refactors to ctx.FormX functions (#16567) 2021-08-11 18:08:52 +03:00
setting.go Remove unused route "/tasks/trigger" (#18160) 2022-01-03 18:23:43 +01:00
setting_protected_branch.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
settings_test.go Move keys to models/asymkey (#17917) 2021-12-10 16:14:24 +08:00
tag.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
topic.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
view.go Fix template bug of LFS lock (#18784) (#18787) 2022-02-16 17:16:04 +00:00
webhook.go Add replay of webhooks. (#18191) 2022-01-05 15:00:20 -06:00
wiki.go Add warning for BIDI characters in page renders and in diffs (#17562) 2022-01-07 02:18:52 +01:00
wiki_test.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00