Compare commits

...

5 Commits

Author SHA1 Message Date
Lauris BH
12f51ec7dd Changelog for v1.12.1 (#12006) 2020-06-22 01:12:42 +03:00
zeripath
82b843a5ab Handle multiple merges in gitgraph.js (#11996) (#12000)
Backport #11996

There is a bug in web_src/js/vendor/gitgraph.js whereby it fails to
handle multiple merges in a single commit correctly. This PR adds
changes to make this work.

Fix #11981

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-06-21 16:08:25 +01:00
silverwind
dcbbf37082 Add serviceworker.js to KnownPublicEntries (#11992) (#11994)
Fixes a wrong 302 redirect to the login page, see https://github.com/go-gitea/gitea/issues/11989.
Also made it so the reserved username list is extended with those known
entries so we avoid code duplication.
2020-06-20 15:23:04 +01:00
Lauris BH
3e8618a543 For language detection do not try to analyze big files by content (#11971) (#11975) 2020-06-19 13:10:03 +03:00
Cirno the Strongest
3a2679db2e Fix scrollable header on dropdowns (#11893) (#11965)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
(cherry picked from commit 1fb783efb0)
2020-06-18 20:25:58 -04:00
7 changed files with 69 additions and 54 deletions

View File

@@ -4,6 +4,20 @@ This changelog goes through all the changes that have been made in each release
without substantial changes to our git log; to see the highlights of what has without substantial changes to our git log; to see the highlights of what has
been added to each release, please refer to the [blog](https://blog.gitea.io). been added to each release, please refer to the [blog](https://blog.gitea.io).
## [1.12.1](https://github.com/go-gitea/gitea/releases/tag/v1.12.1) - 2020-06-21
* BUGFIXES
* Handle multiple merges in gitgraph.js (#11996) (#12000)
* Add serviceworker.js to KnownPublicEntries (#11992) (#11994)
* For language detection do not try to analyze big files by content (#11971) (#11975)
* ENHANCEMENTS
* Fix scrollable header on dropdowns (#11893) (#11965)
## [1.11.8](https://github.com/go-gitea/gitea/releases/tag/v1.11.8) - 2020-06-21
* BUGFIXES
* Really fix __webpack_public_path__ for 1.11 (#11961)
## [1.12.0](https://github.com/go-gitea/gitea/releases/tag/v1.12.0) - 2020-06-17 ## [1.12.0](https://github.com/go-gitea/gitea/releases/tag/v1.12.0) - 2020-06-17
* BREAKING * BREAKING

View File

@@ -29,6 +29,7 @@ import (
"code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/generate"
"code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/public"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/structs"
api "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs"
@@ -878,7 +879,7 @@ func (u *User) IsGhost() bool {
} }
var ( var (
reservedUsernames = []string{ reservedUsernames = append([]string{
".", ".",
"..", "..",
".well-known", ".well-known",
@@ -888,17 +889,13 @@ var (
"attachments", "attachments",
"avatars", "avatars",
"commits", "commits",
"css",
"debug", "debug",
"error", "error",
"explore", "explore",
"fomantic",
"ghost", "ghost",
"help", "help",
"img",
"install", "install",
"issues", "issues",
"js",
"less", "less",
"login", "login",
"manifest.json", "manifest.json",
@@ -916,8 +913,8 @@ var (
"stars", "stars",
"template", "template",
"user", "user",
"vendor", }, public.KnownPublicEntries...)
}
reservedUserPatterns = []string{"*.keys", "*.gpg"} reservedUserPatterns = []string{"*.keys", "*.gpg"}
) )

View File

@@ -17,7 +17,8 @@ import (
"github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/object"
) )
const fileSizeLimit int64 = 16 * 1024 * 1024 const fileSizeLimit int64 = 16 * 1024 // 16 KiB
const bigFileSize int64 = 1024 * 1024 // 1 MiB
// specialLanguages defines list of languages that are excluded from the calculation // specialLanguages defines list of languages that are excluded from the calculation
// unless they are the only language present in repository. Only languages which under // unless they are the only language present in repository. Only languages which under
@@ -62,8 +63,11 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
return nil return nil
} }
// If content can not be read just do detection by filename // If content can not be read or file is too big just do detection by filename
content, _ := readFile(f, fileSizeLimit) var content []byte
if f.Size <= bigFileSize {
content, _ = readFile(f, fileSizeLimit)
}
if enry.IsGenerated(f.Name, content) { if enry.IsGenerated(f.Name, content) {
return nil return nil
} }

View File

@@ -30,12 +30,13 @@ type Options struct {
Prefix string Prefix string
} }
// List of known entries inside the `public` directory // KnownPublicEntries list all direct children in the `public` directory
var knownEntries = []string{ var KnownPublicEntries = []string{
"css", "css",
"fomantic", "fomantic",
"img", "img",
"js", "js",
"serviceworker.js",
"vendor", "vendor",
} }
@@ -114,7 +115,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
if len(parts) < 2 { if len(parts) < 2 {
return false return false
} }
for _, entry := range knownEntries { for _, entry := range KnownPublicEntries {
if entry == parts[1] { if entry == parts[1] {
ctx.Resp.WriteHeader(404) ctx.Resp.WriteHeader(404)
return true return true

View File

@@ -25,9 +25,7 @@
</code> </code>
<strong> {{.Branch}}</strong> <strong> {{.Branch}}</strong>
<span>{{RenderCommitMessage .Subject $.RepoLink $.Repository.ComposeMetas}}</span> by <span>{{RenderCommitMessage .Subject $.RepoLink $.Repository.ComposeMetas}}</span> by
<span class="author"> <span class="author">{{.Author}}</span>
{{.Author}}
</span>
<span class="time">{{.Date}}</span> <span class="time">{{.Date}}</span>
{{ end }} {{ end }}
</li> </li>

View File

@@ -65,7 +65,7 @@ export default function gitGraph(canvas, rawGraphList, config) {
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
midStr = rawGraphList[i].replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, ''); midStr = rawGraphList[i].replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
midStr = midStr.replace(/(--)|(-\.)/g,'-')
maxWidth = Math.max(midStr.replace(/(_|\s)/g, '').length, maxWidth); maxWidth = Math.max(midStr.replace(/(_|\s)/g, '').length, maxWidth);
row = midStr.split(''); row = midStr.split('');
@@ -343,11 +343,6 @@ export default function gitGraph(canvas, rawGraphList, config) {
return (val !== ' ' && val !== '_'); return (val !== ' ' && val !== '_');
}).length; }).length;
// do some clean up
if (flows.length > condenseCurrentLength) {
flows.splice(condenseCurrentLength, flows.length - condenseCurrentLength);
}
colomnIndex = 0; colomnIndex = 0;
// a little inline analysis and draw process // a little inline analysis and draw process
@@ -362,7 +357,7 @@ export default function gitGraph(canvas, rawGraphList, config) {
continue; continue;
} }
// inline interset // inline intersect
if ((colomn === '_' || colomn === '/') if ((colomn === '_' || colomn === '/')
&& currentRow[colomnIndex - 1] === '|' && currentRow[colomnIndex - 1] === '|'
&& currentRow[colomnIndex - 2] === '_') { && currentRow[colomnIndex - 2] === '_') {
@@ -380,6 +375,7 @@ export default function gitGraph(canvas, rawGraphList, config) {
color = flows[colomnIndex].color; color = flows[colomnIndex].color;
switch (colomn) { switch (colomn) {
case '-':
case '_': case '_':
drawLineRight(x, y, color); drawLineRight(x, y, color);
@@ -416,6 +412,11 @@ export default function gitGraph(canvas, rawGraphList, config) {
y -= config.unitSize; y -= config.unitSize;
} }
// do some clean up
if (flows.length > condenseCurrentLength) {
flows.splice(condenseCurrentLength, flows.length - condenseCurrentLength);
}
}; };
init(); init();

View File

@@ -1245,7 +1245,7 @@ i.icon.centerlock {
/* limit width of all direct dropdown menu children */ /* limit width of all direct dropdown menu children */
/* https://github.com/go-gitea/gitea/pull/10835 */ /* https://github.com/go-gitea/gitea/pull/10835 */
.dropdown:not(.selection) > .menu:not(.review-box) > * { .dropdown:not(.selection) > .menu:not(.review-box) > *:not(.header) {
max-width: 300px; max-width: 300px;
overflow-x: hidden; overflow-x: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;