aboutsummaryrefslogtreecommitdiff
path: root/templates/repo
diff options
context:
space:
mode:
authormharinder <mharinder@yandex.com>2017-10-01 05:37:24 -0700
committerUnknwon <u@gogs.io>2017-11-15 23:28:23 -0500
commit5cd1fdeb9ee1af1179a859dc5ed65561bfe5a6d6 (patch)
treef0c36bfd3a763cf7489da93d4d015c8c7fd252b6 /templates/repo
parentdbe6de313efdff942d16b82b63f02fa10d8fc170 (diff)
pull: add an option to use rebase for merging pull requests
For DVCS, either merge or rebase works for getting new code in a pull request in the main branch. The rebase workflow produces a linear history which is cleaner, and more bisect-able. This commit adds a repo-level option to enable the rebase workflow. Once enabled, "Merge Pull Request" will be replaced by "Rebase and Merge Pull Request" which does exactly what the user wants. It's unlikely a project wants a mixed-use of both rebase and merge workflows, therefore the feature is not implemented as a drop-down button like what GitHub does (https://github.com/blog/2243-rebase-and-merge-pull-requests).
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/issue/view_content.tmpl6
-rw-r--r--templates/repo/settings/options.tmpl8
2 files changed, 12 insertions, 2 deletions
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 88f66ef9..f9cf63bf 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -196,7 +196,11 @@
<form class="ui form" action="{{.Link}}/merge" method="post">
{{.CSRFTokenHTML}}
<button class="ui green button">
- <span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
+ {{if .Issue.Repo.PullUseRebase }}
+ <span class="octicon octicon-git-pull-request"></span> {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
+ {{else}}
+ <span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
+ {{end}}
</button>
</form>
</div>
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 0e3256a9..7d3d58d3 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -193,10 +193,16 @@
<div class="inline field">
<label>{{.i18n.Tr "repo.pulls"}}</label>
<div class="ui checkbox">
- <input name="enable_pulls" type="checkbox" {{if .Repository.EnablePulls}}checked{{end}}>
+ <input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if .Repository.EnablePulls}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls_desc"}}</label>
</div>
</div>
+ <div class="ui segment field {{if not .Repository.EnablePulls}}disabled{{end}}" id="pull_box">
+ <div class="ui checkbox">
+ <input name="pull_use_rebase" type="checkbox" {{if .Repository.PullUseRebase}}checked{{end}}>
+ <label>{{.i18n.Tr "repo.settings.use_rebase_desc"}}</label>
+ </div>
+ </div>
{{end}}
<div class="field">