Skip to content

Commit a7b1ba0

Browse files
Cherrglunny
authored andcommitted
wiki history improvements (#7391)
* add history comments to detect page delete Signed-off-by: Michael Gnehr <[email protected]> * fix too much history entries - caused by --follow flag - if files with same contents exists Signed-off-by: Michael Gnehr <[email protected]> * style imprevements wiki - history - wrap long author names Signed-off-by: Michael Gnehr <[email protected]>
1 parent a0820e0 commit a7b1ba0

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

modules/git/repo_commit.go

+10
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
266266
return repo.parsePrettyFormatLogToList(stdout)
267267
}
268268

269+
// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
270+
func (repo *Repository) CommitsByFileAndRangeNoFollow(revision, file string, page int) (*list.List, error) {
271+
stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50),
272+
"--max-count="+strconv.Itoa(CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path)
273+
if err != nil {
274+
return nil, err
275+
}
276+
return repo.parsePrettyFormatLogToList(stdout)
277+
}
278+
269279
// FilesCountBetween return the number of files changed between two commits
270280
func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {
271281
stdout, err := NewCommand("diff", "--name-only", startCommitID+"..."+endCommitID).RunInDir(repo.Path)

public/css/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ footer .ui.left,footer .ui.right{line-height:40px}
292292
.markdown:not(code) .ui.list .list,.markdown:not(code) ol.ui.list ol,.markdown:not(code) ul.ui.list ul{padding-left:2em}
293293
.repository.wiki.revisions .ui.container>.ui.stackable.grid{flex-direction:row-reverse}
294294
.repository.wiki.revisions .ui.container>.ui.stackable.grid>.header{margin-top:0}
295-
.repository.wiki.revisions .ui.container>.ui.stackable.grid>.header .sub.header{padding-left:52px}
295+
.repository.wiki.revisions .ui.container>.ui.stackable.grid>.header .sub.header{padding-left:52px;word-break:break-word}
296296
.file-revisions-btn{display:block;float:left;margin-bottom:2px!important;padding:11px!important;margin-right:10px!important}
297297
.file-revisions-btn i{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
298298
.home .logo{max-width:220px}

public/less/_markdown.less

+1
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@
505505

506506
.sub.header {
507507
padding-left: 52px;
508+
word-break: break-word;
508509
}
509510
}
510511
}

routers/repo/wiki.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry)
248248
}
249249

250250
// get Commit Count
251-
commitsHistory, err := wikiRepo.CommitsByFileAndRange("master", pageFilename, page)
251+
commitsHistory, err := wikiRepo.CommitsByFileAndRangeNoFollow("master", pageFilename, page)
252252
if err != nil {
253-
ctx.ServerError("CommitsByFileAndRange", err)
253+
ctx.ServerError("CommitsByFileAndRangeNoFollow", err)
254254
return nil, nil
255255
}
256256
commitsHistory = models.ValidateCommitsWithEmails(commitsHistory)

templates/repo/wiki/revision.tmpl

+13-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="ui header eight wide column">
3232
<a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}" ><span>{{.revision}}</span> <i class="fa fa-fw fa-file-text-o"></i></a>
3333
{{$title}}
34-
<div class="ui sub header">
34+
<div class="ui sub header wrap">
3535
{{$timeSince := TimeSince .Author.When $.Lang}}
3636
{{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
3737
</div>
@@ -52,8 +52,9 @@
5252
<table class="ui very basic striped fixed table single line" id="commits-table">
5353
<thead>
5454
<tr>
55-
<th class="eight wide">{{.i18n.Tr "repo.commits.author"}}</th>
56-
<th class="four wide sha">SHA1</th>
55+
<th class="four wide">{{.i18n.Tr "repo.commits.author"}}</th>
56+
<th class="tree wide sha">SHA1</th>
57+
<th class="five wide message">{{.i18n.Tr "repo.commits.message"}}</th>
5758
<th class="four wide">{{.i18n.Tr "repo.commits.date"}}</th>
5859
</tr>
5960
</thead>
@@ -86,6 +87,15 @@
8687
{{end}}
8788
</label>
8889
</td>
90+
<td class="message">
91+
<span class="message-wrapper">
92+
<span class="commit-summary has-emoji{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary}}</span>
93+
{{if IsMultilineCommitMessage .Message}}
94+
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
95+
<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre>
96+
{{end}}
97+
</span>
98+
</td>
8999
<td class="grey text">{{TimeSince .Author.When $.Lang}}</td>
90100
</tr>
91101
{{end}}

0 commit comments

Comments
 (0)