Skip to content

Commit e15d400

Browse files
authored
Merge branch 'main' into add-missing-repo-units
2 parents 9cabda9 + 8d9f8e1 commit e15d400

File tree

13 files changed

+55
-36
lines changed

13 files changed

+55
-36
lines changed

models/repo/release.go

+22
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,28 @@ func GetReleasesByRepoID(ctx context.Context, repoID int64, opts FindReleasesOpt
253253
return rels, sess.Find(&rels)
254254
}
255255

256+
// GetTagNamesByRepoID returns a list of release tag names of repository.
257+
func GetTagNamesByRepoID(ctx context.Context, repoID int64) ([]string, error) {
258+
listOptions := db.ListOptions{
259+
ListAll: true,
260+
}
261+
opts := FindReleasesOptions{
262+
ListOptions: listOptions,
263+
IncludeDrafts: true,
264+
IncludeTags: true,
265+
HasSha1: util.OptionalBoolTrue,
266+
}
267+
268+
tags := make([]string, 0)
269+
sess := db.GetEngine(ctx).
270+
Table("release").
271+
Desc("created_unix", "id").
272+
Where(opts.toConds(repoID)).
273+
Cols("tag_name")
274+
275+
return tags, sess.Find(&tags)
276+
}
277+
256278
// CountReleasesByRepoID returns a number of releases matching FindReleaseOptions and RepoID.
257279
func CountReleasesByRepoID(repoID int64, opts FindReleasesOptions) (int64, error) {
258280
return db.GetEngine(db.DefaultContext).Where(opts.toConds(repoID)).Count(new(Release))

modules/context/repo.go

+2-13
Original file line numberDiff line numberDiff line change
@@ -660,20 +660,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
660660
return
661661
}
662662

663-
tags, err := ctx.Repo.GitRepo.GetTags(0, 0)
663+
tags, err := repo_model.GetTagNamesByRepoID(ctx, ctx.Repo.Repository.ID)
664664
if err != nil {
665-
if strings.Contains(err.Error(), "fatal: not a git repository ") {
666-
log.Error("Repository %-v has a broken repository on the file system: %s Error: %v", ctx.Repo.Repository, ctx.Repo.Repository.RepoPath(), err)
667-
ctx.Repo.Repository.Status = repo_model.RepositoryBroken
668-
ctx.Repo.Repository.IsEmpty = true
669-
ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch
670-
// Only allow access to base of repo or settings
671-
if !isHomeOrSettings {
672-
ctx.Redirect(ctx.Repo.RepoLink)
673-
}
674-
return
675-
}
676-
ctx.ServerError("GetTags", err)
665+
ctx.ServerError("GetTagNamesByRepoID", err)
677666
return
678667
}
679668
ctx.Data["Tags"] = tags

modules/git/log_name_status.go

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
5656
} else if treepath != "" {
5757
files = append(files, treepath)
5858
}
59+
// Use the :(literal) pathspec magic to handle edge cases with files named like ":file.txt" or "*.jpg"
60+
for i, file := range files {
61+
files[i] = ":(literal)" + file
62+
}
5963
cmd.AddDashesAndList(files...)
6064

6165
go func() {

modules/templates/helper.go

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func NewFuncMap() []template.FuncMap {
109109
"CustomEmojis": func() map[string]string {
110110
return setting.UI.CustomEmojisMap
111111
},
112+
"IsShowFullName": func() bool {
113+
return setting.UI.DefaultShowFullName
114+
},
112115
"Safe": Safe,
113116
"SafeJS": SafeJS,
114117
"JSEscape": JSEscape,

routers/web/repo/compare.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,9 @@ func CompareDiff(ctx *context.Context) {
717717
return
718718
}
719719

720-
baseGitRepo := ctx.Repo.GitRepo
721-
baseTags, err := baseGitRepo.GetTags(0, 0)
720+
baseTags, err := repo_model.GetTagNamesByRepoID(ctx, ctx.Repo.Repository.ID)
722721
if err != nil {
723-
ctx.ServerError("GetTags", err)
722+
ctx.ServerError("GetTagNamesByRepoID", err)
724723
return
725724
}
726725
ctx.Data["Tags"] = baseTags
@@ -738,9 +737,9 @@ func CompareDiff(ctx *context.Context) {
738737
}
739738
ctx.Data["HeadBranches"] = headBranches
740739

741-
headTags, err := ci.HeadGitRepo.GetTags(0, 0)
740+
headTags, err := repo_model.GetTagNamesByRepoID(ctx, ci.HeadRepo.ID)
742741
if err != nil {
743-
ctx.ServerError("GetTags", err)
742+
ctx.ServerError("GetTagNamesByRepoID", err)
744743
return
745744
}
746745
ctx.Data["HeadTags"] = headTags

templates/repo/issue/list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
135135
{{range .Posters}}
136136
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
137-
{{avatar $.Context .}} {{.GetDisplayName}}
137+
{{avatar $.Context .}}{{template "repo/search_name" .}}
138138
</a>
139139
{{end}}
140140
</div>
@@ -154,7 +154,7 @@
154154
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
155155
{{range .Assignees}}
156156
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
157-
{{avatar $.Context .}} {{.GetDisplayName}}
157+
{{avatar $.Context .}}{{template "repo/search_name" .}}
158158
</a>
159159
{{end}}
160160
</div>

templates/repo/issue/milestone_issues.tmpl

+6-3
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@
7070
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
7171
</span>
7272
<div class="menu">
73+
<div class="ui icon search input">
74+
<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i>
75+
<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_poster"}}">
76+
</div>
7377
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
7478
{{range .Posters}}
7579
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
76-
{{avatar $.Context .}} {{.GetDisplayName}}
80+
{{avatar $.Context .}}{{template "repo/search_name" .}}
7781
</a>
7882
{{end}}
7983
</div>
@@ -93,8 +97,7 @@
9397
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
9498
{{range .Assignees}}
9599
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{.ID}}&poster={{$.PosterID}}">
96-
{{avatar $.Context . 28 "gt-mr-2"}}
97-
{{.GetDisplayName}}
100+
{{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" .}}
98101
</a>
99102
{{end}}
100103
</div>

templates/repo/issue/new_form.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
<a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
187187
<span class="octicon-check invisible">{{svg "octicon-check"}}</span>
188188
<span class="text">
189-
{{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}}
189+
{{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}}
190190
</span>
191191
</a>
192192
{{end}}

templates/repo/issue/view_content/sidebar.tmpl

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
<a class="{{if not .CanChange}}ui tooltip{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-content="{{$.locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}>
2727
<span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
2828
<span class="text">
29-
{{avatar $.Context .User 28 "gt-mr-3"}}
30-
{{.User.GetDisplayName}}
29+
{{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}}
3130
</span>
3231
</a>
3332
{{end}}
@@ -258,8 +257,7 @@
258257
{{end}}
259258
<span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
260259
<span class="text">
261-
{{avatar $.Context . 28 "gt-mr-3"}}
262-
{{.GetDisplayName}}
260+
{{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}}
263261
</span>
264262
</a>
265263
{{end}}

templates/repo/search_name.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}

templates/repo/settings/protected_branch.tmpl

+3-6
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
<div class="menu">
5050
{{range .Users}}
5151
<div class="item" data-value="{{.ID}}">
52-
{{avatar $.Context . 28 "mini"}}
53-
{{.GetDisplayName}}
52+
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
5453
</div>
5554
{{end}}
5655
</div>
@@ -101,8 +100,7 @@
101100
<div class="menu">
102101
{{range .Users}}
103102
<div class="item" data-value="{{.ID}}">
104-
{{avatar $.Context . 28 "mini"}}
105-
{{.GetDisplayName}}
103+
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
106104
</div>
107105
{{end}}
108106
</div>
@@ -181,8 +179,7 @@
181179
<div class="menu">
182180
{{range .Users}}
183181
<div class="item" data-value="{{.ID}}">
184-
{{avatar $.Context . 28 "mini"}}
185-
{{.GetDisplayName}}
182+
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
186183
</div>
187184
{{end}}
188185
</div>

templates/repo/settings/tags.tmpl

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
<div class="menu">
3737
{{range .Users}}
3838
<div class="item" data-value="{{.ID}}">
39-
{{avatar $.Context . 28 "mini"}}
40-
{{.GetDisplayName}}
39+
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
4140
</div>
4241
{{end}}
4342
</div>

web_src/css/repository.css

+4
Original file line numberDiff line numberDiff line change
@@ -3627,3 +3627,7 @@ td.blob-excerpt {
36273627
.pr-status .status-details > span {
36283628
padding-right: 0.5em; /* To match the alignment with the "required" label */
36293629
}
3630+
3631+
.search-fullname {
3632+
color: var(--color-text-light-2);
3633+
}

0 commit comments

Comments
 (0)