This commit is contained in:
Jabberwocky238
2026-07-16 08:33:38 -04:00
parent 3ed6a7d804
commit 3de46894d0
6 changed files with 100 additions and 43 deletions
+6 -7
View File
@@ -46,11 +46,11 @@ func (s *LocalState) nsDir(ns string) (string, error) {
if ns == "" || strings.Contains(ns, "..") {
return "", fmt.Errorf("invalid namespace %q", ns)
}
abs, err := filepath.Abs(filepath.Join(s.root, ns))
abs, err := filepath.Abs(filepath.Join(s.cfg.RepoRoot(), ns))
if err != nil {
return "", err
}
rootAbs, err := filepath.Abs(s.root)
rootAbs, err := filepath.Abs(s.cfg.RepoRoot())
if err != nil {
return "", err
}
@@ -106,8 +106,7 @@ func (s *LocalState) nextNamespaceID() (int64, error) {
// namespace must already exist (have at least one repo) so NamespaceID can be
// resolved; NameID is freshly assigned. skip-auth: disk-only (git init, no DB).
func (s *LocalState) CreateRepo(ns, name string) error {
name = normalizeName(name)
path, err := common.Resolve(s.root, relPath(ns, name))
path, err := s.RepoPath(ns, name)
if err != nil {
return err
}
@@ -164,7 +163,7 @@ func (s *LocalState) ExistRepo(ns, name string) error {
// DeleteRepo removes the repo row, its repo-targeted ACL grants, and the
// on-disk bare directory. Hard-deletes. skip-auth: disk-only.
func (s *LocalState) DeleteRepo(ns, name string) error {
path, _ := common.Resolve(s.root, relPath(ns, name))
path, _ := s.RepoPath(ns, name)
if s.skipAuth {
if path != "" {
_ = os.RemoveAll(path)
@@ -199,11 +198,11 @@ func (s *LocalState) MoveRepo(old, new string) error {
if err != nil {
return err
}
oldPath, err := common.Resolve(s.root, relPath(oldNs, oldName))
oldPath, err := s.RepoPath(oldNs, oldName)
if err != nil {
return err
}
newPath, err := common.Resolve(s.root, relPath(newNs, newName))
newPath, err := s.RepoPath(newNs, newName)
if err != nil {
return err
}