GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — git: add repository and remote archive support by aymanbagabas · Pull Request #2013 · go-git/go-git Conversation
Member
This implements the high level porcelain end of This continues the work that was introduced in #1986
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
aymanbagabas
force-pushed
the
archive-git
branch
from
3fd5170 to
f9a4d62
Compare
aymanbagabas
commented
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already test the remote transport logic in our git transport tests. This ensures the high-level API does validation.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
aymanbagabas
force-pushed
the
archive-git
branch
from
f9a4d62 to
0183df3
Compare
pjbgf
requested changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, LGTM. Let's just tighten the validation on
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add stricter rules here please, for example:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
| File | Description |
|---|---|
| repository.go | Adds ArchiveOptions and local repository archive streaming APIs. |
| archive.go | Adds remote archive entrypoints that handshake and invoke git-upload-archive. |
| internal/archive/archive.go | Refactors archive generation API to accept a resolved tree + commit metadata; adds ErrUnsupportedFormat. |
| plumbing/transport/upload_archive.go | Updates server-side UploadArchive to resolve tree-ish before writing the archive. |
| repository_test.go | Adds coverage for local repository archive generation (formats/prefix/path filtering/cancellation). |
| archive_test.go | Adds unit tests for ArchiveOptions.Validate and basic ArchiveRemote argument/validation behavior. |
archive_test.go:122
tt. Since tt is reused across iterations, t.Parallel() can lead to subtests using the wrong url/options/wantErr values. Rebind tt := tt (or switch to an index loop) before t.Run. for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, err := ArchiveRemote(tt.url, tt.opts)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| return arch.Archive(ctx, &transport.ArchiveRequest{ | ||
| Args: args, | ||
| Progress: o.Progress, | ||
| }) |
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
5924d14 to
9293937
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| name: "remote allows custom format", | ||
| url: "file:///tmp/repo.git", | ||
| opts: &ArchiveOptions{Format: "tar.xz", Treeish: "master"}, | ||
| wantErr: "", | ||
| }, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
File here is the transport and our client resolved the url to our default file transport. Custom transports can be added via ClientOptions. If a transport is not supported or valid, we error during the construction of client.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ff3e445 to
c1dafd7
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
archive_test.go:136
t.Parallel() but capture the range variable tt from the outer loop. Rebind tt := tt inside the loop before t.Run to avoid all subtests using the last case / racing. for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, err := ArchiveRemote(tt.url, tt.opts)
if tt.wantErr == "" {
archive_test.go:213
t.Parallel() but capture the range variable tt from the outer loop. Rebind tt := tt inside the loop before t.Run (this also ensures each subtest uses the intended tt.opts pointer). for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
rc, err := ArchiveRemote(repoURL, tt.opts)
require.NoError(t, err)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| base := t.TempDir() | ||
| repoFS := test.PrepareRepository(t, fixtures.Basic().One(), base, "basic.git") | ||
| repoPath, err := filepath.Abs(repoFS.Root()) | ||
| require.NoError(t, err) | ||
| repoURL := "file://" + repoPath | ||
|
|
Signed-off-by: Ayman Bagabas <[email protected]>
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit on defer sess.Close(). Apart from that, please rebase it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@aymanbagabas thanks for working on this. 🙇
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.