Handle "git archive" via headers
Merge request reports
Activity
Added 1 commit:
- ec168f4b - Use interfaces
Added 1 commit:
- 2788c575 - Skip empty send-data header quicker
What do you think @ayufan ?
2 2 3 3 import ( 4 4 "../helper" 5 "encoding/base64" 6 "encoding/json" 5 "../senddata" 7 6 "fmt" 8 7 "io" 9 8 "log" 10 9 "net/http" 11 "strings" 12 10 ) 13 11 14 type blobParams struct { I did prefer the struct here, because it is simpler to read. Instead of inline:
var params struct{}
Edited by Kamil Trzcińśki
I like the change. It makes sense to implement this that way
👍 Edited by Kamil TrzcińśkiAdded 1 commit:
- 28c9928c - Declare params structs outside Inject functions
@ayufan could you have another look?
659 659 }) 660 660 } 661 661 662 func archiveOKServer(t *testing.T, archiveName string) *httptest.Server { 663 return testhelper.TestServerWithHandler(regexp.MustCompile("."), func(w http.ResponseWriter, r *http.Request) { @ayufan I am not sure if this is going to work.
% git grep -n ArchiveOKServer internal/git/archive_test.go:15:func ArchiveOKServer(t *testing.T, repoPath, archiveName, cacheDir string) *httptest.Server { main_test.go:119: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:138: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:157: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:176: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:195: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:214: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:237: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir) main_test.go:268: ts := git.ArchiveOKServer(t, repoPath(t), archiveName, cacheDir)
You can see above I moved the function into the 'git' package. But when I try to run the test:
% support/path go test # _/Volumes/GitLab.com/gitlab-development-kit/gitlab-workhorse ./main_test.go:119: undefined: git.ArchiveOKServer ./main_test.go:138: undefined: git.ArchiveOKServer ./main_test.go:157: undefined: git.ArchiveOKServer ./main_test.go:176: undefined: git.ArchiveOKServer ./main_test.go:195: undefined: git.ArchiveOKServer ./main_test.go:214: undefined: git.ArchiveOKServer ./main_test.go:237: undefined: git.ArchiveOKServer ./main_test.go:268: undefined: git.ArchiveOKServer FAIL _/Volumes/GitLab.com/gitlab-development-kit/gitlab-workhorse [build failed]
659 659 }) 660 660 } 661 661 662 func archiveOKServer(t *testing.T, archiveName string) *httptest.Server { 663 return testhelper.TestServerWithHandler(regexp.MustCompile("."), func(w http.ResponseWriter, r *http.Request) { 664 cwd, err := os.Getwd() 665 if err != nil { 666 t.Fatal(err) 667 } 668 archivePath := path.Join(cwd, cacheDir, archiveName) 669 670 params := struct{ RepoPath, ArchivePath, CommitId, ArchivePrefix string }{ Added 1 commit:
- 92e88955 - Simplify WriteHeader in senddata
Added 22 commits:
-
92e88955...3f8da4ae - 19 commits from branch
master
- 1a9126c9 - Add fmt task
- adf7680a - Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-workhorse into archive-header
- f9e11b15 - Remove unnecessary step from main_test.go
Toggle commit list-
92e88955...3f8da4ae - 19 commits from branch
Added 1 commit:
- 85e6cbf8 - Use an early return in senddata.tryInject
@ayufan I am not going to spend more time trying to move that one test helper; I could not get it to work.
mentioned in commit 153527fb
@jacobvosmaer It's OK. My idea was to test the
archive
in it's ownpackage
and not put that inmain
.Testing discussion: !39 (merged)
mentioned in merge request !39 (merged)
Mentioned in commit pfjason/gitlab-ce@879d66b6