MCPcopy Index your code
hub / github.com/gogs/gogs / isRepositoryGitPath

Function isRepositoryGitPath

internal/database/repo_editor.go:539–548  ·  view source on GitHub ↗

isRepositoryGitPath returns true if given path is or resides inside ".git" path of the repository. TODO(unknwon): Move to repoutil during refactoring for this file.

(path string)

Source from the content-addressed store, hash-verified

537//
538// TODO(unknwon): Move to repoutil during refactoring for this file.
539func isRepositoryGitPath(path string) bool {
540 path = strings.ToLower(path)
541 return strings.HasSuffix(path, ".git") ||
542 strings.Contains(path, ".git/") ||
543 strings.Contains(path, `.git\`) ||
544 // Windows treats ".git." the same as ".git"
545 strings.HasSuffix(path, ".git.") ||
546 strings.Contains(path, ".git./") ||
547 strings.Contains(path, `.git.\`)
548}
549
550func (r *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) error {
551 if len(opts.Files) == 0 {

Callers 5

UpdateRepoFileMethod · 0.85
GetDiffPreviewMethod · 0.85
DeleteRepoFileMethod · 0.85
UploadRepoFilesMethod · 0.85
TestIsRepositoryGitPathFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsRepositoryGitPathFunction · 0.68