s
This commit is contained in:
+6
-7
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user