aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2021-10-09 01:03:04 +0800
committerGitHub <noreply@github.com>2021-10-08 19:03:04 +0200
commitbb393596689ee7c33ecb041806ae2c9e8dc5dfab (patch)
treec6b71f73e53d5d5c1bb1da9e47e917f23538cd3f /templates/repo
parent56d79301b9f212e7801cbced1475238cc61c0748 (diff)
downloadgitea-bb393596689ee7c33ecb041806ae2c9e8dc5dfab.tar.gz
gitea-bb393596689ee7c33ecb041806ae2c9e8dc5dfab.zip
Add a simple way to rename branch like gh (#15870)
- Update default branch if needed - Update protected branch if needed - Update all not merged pull request base branch name - Rename git branch - Record this rename work and auto redirect for old branch on ui Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/settings/branches.tmpl22
1 files changed, 22 insertions, 0 deletions
diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl
index ccf6abbb81..89d7c6db77 100644
--- a/templates/repo/settings/branches.tmpl
+++ b/templates/repo/settings/branches.tmpl
@@ -77,6 +77,28 @@
</div>
</div>
</div>
+
+ {{if $.Repository.CanCreateBranch}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "repo.settings.rename_branch"}}
+ </h4>
+ <div class="ui attached segment">
+ <form class="ui form" action="{{$.Repository.Link}}/settings/rename_branch" method="post">
+ {{.CsrfTokenHtml}}
+ <div class="required field">
+ <label for="from">{{.i18n.Tr "repo.settings.rename_branch_from"}}</label>
+ <input id="from" name="from" required>
+ </div>
+ <div class="required field {{if .Err_BranchName}}error{{end}}">
+ <label for="to">{{.i18n.Tr "repo.settings.rename_branch_to"}}</label>
+ <input id="to" name="to" required>
+ </div>
+ <div class="field">
+ <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
+ </div>
+ </form>
+ </div>
+ {{end}}
{{end}}
</div>
</div>