From 9e04be2ca3d8980ebc8ec791d005ba77382fb1fa Mon Sep 17 00:00:00 2001 From: Max Resnick Date: Sat, 11 Feb 2023 22:23:57 -0800 Subject: disable export all, fix path name --- internal/admin/model.go | 2 +- internal/admin/model_test.go | 4 ++-- internal/git/handler.go | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'internal') 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") } diff --git a/internal/git/handler.go b/internal/git/handler.go index 6f29483..e90ab5f 100644 --- a/internal/git/handler.go +++ b/internal/git/handler.go @@ -18,8 +18,6 @@ func GitHttpBackendHandler(reposDir, backendCommand string) http.Handler { Dir: ".", Env: []string{ projectDirEnv, - // TODO we don't want to export all - "GIT_HTTP_EXPORT_ALL=1", fmt.Sprintf("REMOTE_USER=%s", uid), }, } -- cgit v1.2.3