Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b5b079

Browse files
authored
Merge branch 'main' into fix-code-highlight
2 parents adaf320 + a036507 commit 9b5b079

File tree

3 files changed

+15
-40
lines changed

3 files changed

+15
-40
lines changed

modules/git/git.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,19 @@ func syncGitConfig() (err error) {
251251
}
252252
}
253253

254+
// Due to CVE-2022-24765, git now denies access to git directories which are not owned by current user
255+
// however, some docker users and samba users find it difficult to configure their systems so that Gitea's git repositories are owned by the Gitea user. (Possibly Windows Service users - but ownership in this case should really be set correctly on the filesystem.)
256+
// see issue: https://github.com/go-gitea/gitea/issues/19455
257+
// Fundamentally the problem lies with the uid-gid-mapping mechanism for filesystems in docker on windows (and to a lesser extent samba).
258+
// Docker's configuration mechanism for local filesystems provides no way of setting this mapping and although there is a mechanism for setting this uid through using cifs mounting it is complicated and essentially undocumented
259+
// Thus the owner uid/gid for files on these filesystems will be marked as root.
260+
// As Gitea now always use its internal git config file, and access to the git repositories is managed through Gitea,
261+
// it is now safe to set "safe.directory=*" for internal usage only.
262+
// Please note: the wildcard "*" is only supported by Git 2.30.4/2.31.3/2.32.2/2.33.3/2.34.3/2.35.3/2.36 and later
263+
// Although only supported by Git 2.30.4/2.31.3/2.32.2/2.33.3/2.34.3/2.35.3/2.36 and later - this setting is tolerated by earlier versions
264+
if err := configAddNonExist("safe.directory", "*"); err != nil {
265+
return err
266+
}
254267
if runtime.GOOS == "windows" {
255268
if err := configSet("core.longpaths", "true"); err != nil {
256269
return err

routers/web/repo/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func renderReadmeFile(ctx *context.Context, readmeFile *namedBlob, readmeTreelin
357357
var result strings.Builder
358358
err := markup.Render(&markup.RenderContext{
359359
Ctx: ctx,
360-
RelativePath: ctx.Repo.TreePath,
360+
RelativePath: path.Join(ctx.Repo.TreePath, readmeFile.name), // ctx.Repo.TreePath is the directory not the Readme so we must append the Readme filename (and path).
361361
URLPrefix: readmeTreelink,
362362
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
363363
GitRepo: ctx.Repo.GitRepo,

templates/repo/issue/view_content/pull.tmpl

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
{{end}}
284284
{{end}}
285285

286-
{{if (gt .Issue.PullRequest.CommitsBehind 0)}}
286+
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
287287
<div class="ui divider"></div>
288288
<div class="item item-section">
289289
<div class="item-section-left">
@@ -481,44 +481,6 @@
481481
{{end}}
482482
{{end}}
483483

484-
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
485-
<div class="item df ac sb">
486-
<div>
487-
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
488-
{{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
489-
</div>
490-
<div>
491-
{{if and .UpdateAllowed .UpdateByRebaseAllowed }}
492-
<div class="dib">
493-
<div class="ui buttons update-button">
494-
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
495-
<span class="button-text">
496-
{{$.i18n.Tr "repo.pulls.update_branch"}}
497-
</span>
498-
</button>
499-
500-
<div class="ui dropdown icon button no-text">
501-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
502-
<div class="menu">
503-
<div class="item active selected" data-do="{{.Link}}/update">{{$.i18n.Tr "repo.pulls.update_branch"}}</div>
504-
<div class="item" data-do="{{.Link}}/update?style=rebase">{{$.i18n.Tr "repo.pulls.update_branch_rebase"}}</div>
505-
</div>
506-
</div>
507-
</div>
508-
</div>
509-
{{end}}
510-
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
511-
<form action="{{.Link}}/update" method="post">
512-
{{.CsrfTokenHtml}}
513-
<button class="ui compact button" data-do="update">
514-
<span class="ui text">{{$.i18n.Tr "repo.pulls.update_branch"}}</span>
515-
</button>
516-
</form>
517-
{{end}}
518-
</div>
519-
</div>
520-
{{end}}
521-
522484
{{if $.StillCanManualMerge}}
523485
<div class="ui divider"></div>
524486
<div class="ui form manually-merged-fields" style="display: none">

0 commit comments

Comments
 (0)