~gitpocket/gitpocket

8

fix(import): stop a shadowed error from hiding failed repository setup

commit
4f0c3accd8316881ee1f5aefa11105038b1589ba browse tree
parent
afe9eeb7545ead1afb02033900068b2c60de3277
author
~james <354576047+[email protected]>
signature
Signed by: ~james SHA256:KlzJ0P0gvJcnOYpaxD5yCUw52ImHttTKRjVAEnnYnKg
date
2026-11-14 14:40 UTC

3 files changed, +2 −14

forge/feature_test.go modified

@@ -201,7 +201,6 @@ func TestReservedNames(t *testing.T) {
201201 type pushRig struct {
202202 t *testing.T
203203 s *Server
204- url string
205204 work string
206205 }
207206

forge/import.go modified

@@ -190,16 +190,10 @@ func (s *Server) importRepo(w http.ResponseWriter, r *http.Request) {
190190 return
191191 }
192192 dir := s.repoDir(repo)
193- if err := os.MkdirAll(path.Dir(dir), 0o755); err == nil {
194- err = initRepo(dir)
195- }
196- if err != nil {
197- os.RemoveAll(dir)
198- s.store.DeleteRepo(repo.ID)
199- fail("Could not create the repository")
193+ if err := s.materialise(repo, initRepo); err != nil {
194+ fail(err.Error())
200195 return
201196 }
202- installHook(s.root, s.host, dir)
203197 s.uploads.fail("import:" + u.Name)
204198 if r.FormValue("mirror") == "on" {
205199 box, err := seal(s.root, strings.TrimSpace(r.FormValue("token")))

forge/moderation.go modified

@@ -4,7 +4,6 @@ import (
44 "errors"
55 "fmt"
66 "net/http"
7- "net/url"
87 "os"
98 "strconv"
109 "strings"
@@ -392,7 +391,3 @@ func (s *Server) reportAuthor(rep Report) string {
392391 }
393392 return ""
394393 }
395-
396-func reportURL(kind, target string) string {
397- return "/report?kind=" + kind + "&target=" + url.QueryEscape(target)
398-}