Skip to content

Commit 267a2ec

Browse files
committed
fill default branch name
1 parent c0d1960 commit 267a2ec

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

routers/web/repo/issue_dev.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func CreateBranchFromIssue(ctx *context.Context) {
4040
form := web.GetForm(ctx).(*forms.NewBranchForm)
4141
repo := ctx.Repo.Repository
4242
gitRepo := ctx.Repo.GitRepo
43-
if form.RepoID > 0 {
43+
// if create branch in a forked repository
44+
if form.RepoID > 0 && form.RepoID != repo.ID {
4445
var err error
4546
repo, err = repo_model.GetRepositoryByID(ctx, form.RepoID)
4647
if err != nil {

templates/repo/issue/sidebar/development.tmpl

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
<form class="ui form form-fetch-action" action="{{.Issue.Link}}/create_branch"
5858
method="post">
5959
{{.CsrfTokenHtml}}
60-
<div class="field">
60+
<div class="required field">
6161
<label for="new_branch_name">{{ctx.Locale.Tr "form.NewBranchName"}}</label>
62-
<input name="new_branch_name" type="text">
62+
<input name="new_branch_name" type="text" required>
6363
</div>
6464

65-
<div class="field">
65+
<div class="required field">
6666
<label for="source_repository">{{ctx.Locale.Tr "repo.issues.create_branch_from_repository"}}</label>
6767
<div class="ui fluid dropdown selection">
6868
<select name="repo_id">
@@ -82,21 +82,19 @@
8282
</div>
8383
</div>
8484

85-
<div class="field">
85+
<div class="required field">
8686
<label for="source_branch_name">{{ctx.Locale.Tr "repo.issues.base_branch"}}</label>
87-
<div class="ui fluid dropdown selection">
88-
<select name="source_branch_name">
89-
{{range .Branches}}
90-
<option value="{{.}}">{{.}}</option>
91-
{{end}}
92-
</select>
87+
<div class="ui selection dropdown">
88+
<input type="hidden" id="source_branch_name" name="source_branch_name" value="{{.Issue.Repo.DefaultBranch}}" required>
89+
<span class="text truncated-item-container" data-value="{{.Issue.Repo.DefaultBranch}}" title="{{.Issue.Repo.DefaultBranch}}">
90+
<span class="truncated-item-name">{{.Issue.Repo.DefaultBranch}}</span>
91+
</span>
9392
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
94-
95-
<div class="default text"> </div>
96-
97-
<div class="menu tw-overflow-hidden tw-max-w-full">
93+
<div class="menu">
9894
{{range .Branches}}
99-
<div data-value="{{.}}" data-tooltip-content="{{.}}" class="item tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">{{.}}</div>
95+
<div class="item truncated-item-container" data-value="{{.}}" title="{{.}}">
96+
<span class="truncated-item-name">{{.}}</span>
97+
</div>
10098
{{end}}
10199
</div>
102100
</div>

0 commit comments

Comments
 (0)