diff options
author | a1012112796 <1012112796@qq.com> | 2024-08-10 09:09:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-10 01:09:34 +0000 |
commit | 9633f336c87947dc7d2a5e76077a10699ba5e50d (patch) | |
tree | 190890b651f82e757d9746dde8c6528c9c79c6ab | |
parent | df27846628fc0a8a20f59fc60ca4e0107585ea05 (diff) | |
download | gitea-9633f336c87947dc7d2a5e76077a10699ba5e50d.tar.gz gitea-9633f336c87947dc7d2a5e76077a10699ba5e50d.zip |
Add warning message in merge instructions when `AutodetectManualMerge` was not enabled (#31805)
not enabled
quick-f-i-x https://github.com/go-gitea/gitea/issues/31433 ? , maybe
need more disscusion about better solutions.
example view:

adtion notes about how to enable `AutodetectManualMerge`

Signed-off-by: a1012112796 <1012112796@qq.com>
-rw-r--r-- | options/locale/locale_en-US.ini | 1 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull_merge_instruction.tmpl | 8 |
3 files changed, 10 insertions, 1 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index cca068a3a2..28b3df6c49 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1891,6 +1891,7 @@ pulls.cmd_instruction_checkout_title = Checkout pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes. pulls.cmd_instruction_merge_title = Merge pulls.cmd_instruction_merge_desc = Merge the changes and update on Gitea. +pulls.cmd_instruction_merge_warning = Warning: This operation can not merge pull request because "autodetect manual merge" was not enable pulls.clear_merge_message = Clear merge message pulls.clear_merge_message_hint = Clearing the merge message will only remove the commit message content and keep generated git trailers such as "Co-Authored-By …". diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 4773cc9adc..691de94290 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1869,6 +1869,8 @@ func ViewIssue(ctx *context.Context) { } prConfig := prUnit.PullRequestsConfig() + ctx.Data["AutodetectManualMerge"] = prConfig.AutodetectManualMerge + var mergeStyle repo_model.MergeStyle // Check correct values and select default if ms, ok := ctx.Data["MergeStyle"].(repo_model.MergeStyle); !ok || diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index bb59b49719..9a3e2cb7d7 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -15,7 +15,13 @@ <div>git checkout {{$localBranch}}</div> </div> {{if .ShowMergeInstructions}} - <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}</div> + <div> + <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3> + {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} + {{if not .AutodetectManualMerge}} + <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div> + {{end}} + </div> <div class="ui secondary segment"> <div data-pull-merge-style="merge"> <div>git checkout {{.PullRequest.BaseBranch}}</div> |