diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-03-07 18:41:57 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-04-04 13:54:32 +0300 |
commit | fe453bcfb58e8c4ab8e642ed068ced5880b11a96 (patch) | |
tree | 531e3006bb578f56fa4cca79050fe4d01d6a9ac9 | |
parent | f43afbe236a1b17d31a8aaff8df5a593b8d6e523 (diff) |
Export IsRailsPoolPath from houskeeping package
This commits exports the IsRailsPoolPath function from the housekeeping
package so the upcoming DeleteObjectPool handler in Praefect can
use it to determine whether the object pool has a valid path.
-rw-r--r-- | internal/git/housekeeping/object_pool.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/git/housekeeping/object_pool.go b/internal/git/housekeeping/object_pool.go index f970757de..1e4a935c8 100644 --- a/internal/git/housekeeping/object_pool.go +++ b/internal/git/housekeeping/object_pool.go @@ -8,7 +8,8 @@ import ( // railsPoolDirRegexp is used to validate object pool directory structure and name as generated by Rails. var railsPoolDirRegexp = regexp.MustCompile(`^@pools/([0-9a-f]{2})/([0-9a-f]{2})/([0-9a-f]{64})\.git$`) -func isRailsPoolPath(relativePath string) bool { +// IsRailsPoolPath returns whether the relative path indicates this is a pool path generated by Rails. +func IsRailsPoolPath(relativePath string) bool { matches := railsPoolDirRegexp.FindStringSubmatch(relativePath) if matches == nil || !strings.HasPrefix(matches[3], matches[1]+matches[2]) { return false @@ -20,5 +21,5 @@ func isRailsPoolPath(relativePath string) bool { // IsPoolPath returns whether the relative path indicates the repository is an object // pool. func IsPoolPath(relativePath string) bool { - return isRailsPoolPath(relativePath) + return IsRailsPoolPath(relativePath) } |