MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / hasEntryFile

Method hasEntryFile

component/space.go:708–728  ·  view source on GitHub ↗
(ctx context.Context, namespace, name, entryFile string)

Source from the content-addressed store, hash-verified

706}
707
708func (c *SpaceComponent) hasEntryFile(ctx context.Context, namespace, name, entryFile string) bool {
709 var req gitserver.GetRepoInfoByPathReq
710 req.Namespace = namespace
711 req.Name = name
712 // root dir
713 req.Path = ""
714 req.RepoType = types.SpaceRepo
715 files, err := c.git.GetRepoFileTree(ctx, req)
716 if err != nil {
717 slog.Error("check repo app file existence failed", slog.Any("eror", err))
718 return false
719 }
720
721 for _, f := range files {
722 if f.Type == "file" && f.Path == entryFile {
723 return true
724 }
725 }
726
727 return false
728}
729
730func (c *SpaceComponent) mergeUpdateSpaceRequest(ctx context.Context, space *database.Space, req *types.UpdateSpaceReq) error {
731 // Do not update column value if request body do not have it

Callers 1

HasEntryFileMethod · 0.95

Calls 2

ErrorMethod · 0.80
GetRepoFileTreeMethod · 0.65

Tested by

no test coverage detected