diff options
Diffstat (limited to 'internal/admin')
| -rw-r--r-- | internal/admin/model.go | 2 | ||||
| -rw-r--r-- | internal/admin/model_test.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/admin/model.go b/internal/admin/model.go index d9eea03..cf69fcd 100644 --- a/internal/admin/model.go +++ b/internal/admin/model.go @@ -137,7 +137,7 @@ func (r *GitRepo) CasbinPolicies() [][]string { // ReconcileRepo update repo export settings, update web config func (r *GitRepo) ReconcileRepo(basePath string) { // if exist -> continue - repoBase := filepath.Join(basePath, r.Name, ".git") + repoBase := filepath.Join(basePath, fmt.Sprintf("%s.git", r.Name)) _, err := os.Stat(repoBase) if errors.Is(err, fs.ErrNotExist) { // if no exist -> init bare diff --git a/internal/admin/model_test.go b/internal/admin/model_test.go index a4b5874..79e3cb5 100644 --- a/internal/admin/model_test.go +++ b/internal/admin/model_test.go @@ -159,7 +159,7 @@ func TestRepoReconcile(t *testing.T) { "url", }, } - repoPath := filepath.Join(tempDir, repo.Name, ".git") + repoPath := filepath.Join(tempDir, fmt.Sprintf("%s.git", repo.Name)) repo.ReconcileRepo(tempDir) if _, err := os.Stat(repoPath); errors.Is(err, fs.ErrNotExist) { t.Fatal("expected repo to be created, but does not exist") @@ -181,7 +181,7 @@ bare = true if !strings.Contains(string(content), "description") { t.Fatal("expected to find 'description' in config, didn't found", string(content)) } - gitExportMagicPath := filepath.Join(tempDir, repo.Name, ".git", GitExportMagic) + gitExportMagicPath := filepath.Join(tempDir, fmt.Sprintf("%s.git", repo.Name), GitExportMagic) if _, err := os.Stat(gitExportMagicPath); errors.Is(err, fs.ErrNotExist) { t.Fatal("expected git export magic to be created, but does not exist") } |