mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Show in Web UI if file is vendored and generated (#28620)
This simple shows in the Web UI is a file is vendored and/or generated.   --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
ee3e83eec1
commit
7ed18566e1
3 changed files with 27 additions and 0 deletions
|
@ -647,6 +647,21 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry) {
|
|||
}
|
||||
}
|
||||
|
||||
if ctx.Repo.GitRepo != nil {
|
||||
checker, deferable := ctx.Repo.GitRepo.CheckAttributeReader(ctx.Repo.CommitID)
|
||||
if checker != nil {
|
||||
defer deferable()
|
||||
attrs, err := checker.CheckPath(ctx.Repo.TreePath)
|
||||
if err == nil {
|
||||
vendored, has := attrs["linguist-vendored"]
|
||||
ctx.Data["IsVendored"] = has && (vendored == "set" || vendored == "true")
|
||||
|
||||
generated, has := attrs["linguist-generated"]
|
||||
ctx.Data["IsGenerated"] = has && (generated == "set" || generated == "true")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if fInfo.st.IsImage() && !fInfo.st.IsSvgImage() {
|
||||
img, _, err := image.DecodeConfig(bytes.NewReader(buf))
|
||||
if err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue