aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
Commit message (Collapse)AuthorAgeFilesLines
* transport/file: fix race condition on test (#267)Alberto Cortés2017-02-151-45/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, the `TestClone` and `TestPush` tests of `transport/file` fail in travis. This is due to a race condition caused by an incorrect usage of `Cmd.Wait()` while reading from the output and error pipes of the command. This patch fixes the problem by using `Cmd.CombinedOutput()` instead of calling `Cmd.Start()` and `Cmd.Wait()` while reading from the output and error pipes. Details: From the `exec` package documentation: ``` Wait will close the pipe after seeing the command exit, so most callers need not close the pipe themselves; however, an implication is that it is incorrect to call Wait before all reads from the pipe have completed. For the same reason, it is incorrect to call Run when using StdoutPipe. ``` In our tests, the old `execAndGetOutput` function was creating two gorutines to read from the stderr and stdout pipes of the command and then call `Wait` on the command. This caused a race condition: when the `Wait` call finished before the gorutines have read from the pipes, they returned caused an error on `outErr`. The problem only happens sometimes on travis. To reproduce the problem locally, just add a call to time.Sleep(time.Second) to the gorutine before its `ioutil.ReadAll` call to delay them, then `Wait` will always finish before them, closing the pipes, and the gorutines will fail. The returned error detected by the test will be: ``` FAIL: server_test.go:55: ServerSuite.TestClone server_test.go:65: c.Assert(err, IsNil, Commentf("STDOUT:\n%s\nSTDERR:\n%s\n", stdout, stderr)) ... value *os.PathError = &os.PathError{Op:"read", Path:"|0", Err:0x9} ("read |0: bad file descriptor") ... STDOUT: STDERR: ```
* transport/file: delete suite tmp dir at teardown (#266)Alberto Cortés2017-02-131-5/+12
| | | | | | | | | | | The transport/file common suite test generates a temporal directory; It is used to store the go-git client command and some links to it: git-upload-pack and git-receive-pack. This directory is not deleted at the test teardown, so every time we run a test, we pollute "/tmp". This patch adds a teardown function for the suite that deletes the temporal directory. It also calls the teardown of the embedded fixtures.Suite, which is probably what we want also. I have also simplify the call to ioutil.TempDir as it already uses the default tmp dir if no dir is provided.
* package plumbing documentation improvements (#248)Máximo Cuadros2017-02-075-1/+6
|
* documentation changesMáximo Cuadros2017-01-311-1/+1
|
* new srcd.works/go-git.v4 pathMáximo Cuadros2017-01-3029-89/+89
|
* new git fixture pathMáximo Cuadros2017-01-307-7/+7
|
* rename billy importsMáximo Cuadros2017-01-301-2/+2
|
* transport/http: fix partial request with haves. Fix #216. (#221)Antonio Navarro Perez2017-01-255-4/+27
|
* transport: remove SetAuth, fixes #206 (#210)Anthony Weems2017-01-1719-120/+101
| | | | | * remove SetAuth functions, implement at NewUploadPackSession/NewReceivePackSession level. * propagate transport.Auth from Fetch/Pull/Clone options to the transport API.
* server: add git server implementation (#190)Santiago M. Mola2017-01-0428-273/+1250
| | | | | | | | | | | | | | | * server: add generic server implementation (transport-independent), both for git-upload-pack and git-receive-pack. * server: move internal functions to internal/common. * cli: add git-receive-pack and git-upload-pack implementations. * format/packfile: add UpdateObjectStorage function, extracted from Remote. * transport: implement tranport RPC-like, only with git-upload-pack and git-receive-pack methods. Client renamed to Transport. * storer: add storer.Storer interface. * protocol/packp: add UploadPackResponse constructor with packfile. * protocol/packp: fix UploadPackResponse encoding, add tests. * protocol/packp/capability: implement All.
* remote: add Push (#178)Santiago M. Mola2016-12-192-10/+47
| | | | | | | | | | | | * remote: add Push. * add Push method to Remote. * add method Push to Repository. * examples: add push example. * requested changes * add tests, fixes
* packfile: delta selection logic (#182)Antonio Navarro Perez2016-12-161-1/+1
| | | | | | | | | | * packfile: delta selection logic - Implemented logic to assign deltas to objects * Requested changes * Improved tests and fix errors
* transport: ssh, keeping the original path (#189)Máximo Cuadros2016-12-151-4/+1
|
* transport/git: fix pktline encode and timeoutMáximo Cuadros2016-12-121-8/+3
|
* plumbing/transport/git: fix import (#179)Santiago M. Mola2016-12-121-1/+1
|
* transport: new git protocol (#175)Máximo Cuadros2016-12-125-32/+223
|
* transport: add git-send-pack support to local/ssh. (#163)Santiago M. Mola2016-12-099-15/+463
| | | | | | | | | * protocol/packp: add Packfile field to ReferenceUpdateRequest. * protocol/packp: add NewReferenceUpdateRequestFromCapabilities. * NewReferenceUpdateRequestFromCapabilities can be used to create a ReferenceUpdateRequest with initial capabilities compatible with the server. * protocol/packp: fix new line handling on report status. * transport/file: test error on unexisting command.
* plumbing/transport: allow AdvertisedReferences being called multiple times. ↵Santiago M. Mola2016-12-085-31/+23
| | | | | | | | (#165) * AdvertisedReferences is now part of transport.Session. * It is allowed to be called more than once. * It is allowed to be called before and after FetchPack/SendPack. * Implementations cache its result.
* remote: sideband support (#164)Máximo Cuadros2016-12-073-33/+20
| | | | | | * remote: sideband support * changes
* revision based on goreportcard.comMáximo Cuadros2016-12-062-3/+2
|
* protocol/packp: UploadPackResponse implementation (#161)Máximo Cuadros2016-12-063-49/+25
| | | | | | | | | | | | | | | | * plumbing/protocol: paktp avoid duplication of haves, wants and shallow * protocol/pakp: UploadPackResponse implementation * changes * changes * changes * debug * changes
* transport/internal: error handling fixes and clean up (#160)Santiago M. Mola2016-12-063-21/+128
| | | | | | | | | | | | | | | | | | | | * protocol/packp: remove redundant isFlush check on AdvRefs. * protocol/packp: improve AdvRefs documentation. * transport: improve error handling for non-existing repos. * protocol/packp: AdvRefs Decode now returns different errors for empty, but syntactically correct, AdvRefs message (ErrEmptyAdvRefs) and empty input (ErrEmptyInput). * transport/internal/common: read stderr only when needed (ErrEmptyInput). Close the client gracefully. * transport/internal/common: missing stderr on non existing repository does not block. * transport/internal/common: buffer error messages. * transport/file: fix changing binary name, add tests. * transport/file: support changing git-upload-pack and git-receive-pack binary names. * transport/file: add tests for misbehaving servers. * transport/internal/common: remove Stderr field. * transport/internal/common: do not close twice.
* capabilities: full integration (#151)Máximo Cuadros2016-12-016-11/+75
| | | | | | | | | | | | | | | | | | * format/pktline: fix readPayloadLen err handling * protocol/pakp: UploadReq validation and creation of capabilities * protocol/pakp: AdvRef tests * protocol/pakp: capability.List.Delete * protocol: filter unsupported capabilities * remote capability negociation * transport: UploadRequest validation * requested changes
* protocol/packp: capabilities new Capability entity and List struct, test ↵Máximo Cuadros2016-11-291-2/+5
| | | | | | | | | | improvements (#144) * protocol/pakp: capabilities new Capability entity and List struct, test improvements * etc: example cloud-config file * removing sorting from List.String
* transport: add local transport (#145)Santiago M. Mola2016-11-2911-333/+479
| | | | | * transport: move common packp protocol out of ssh transport. * fixtures: add fixture for empty repository. * transport: add file:// transport
* remove old types from transport and use packp (#142)Santiago M. Mola2016-11-289-353/+87
| | | | | | | | | | * protocol: move UploadPackRequest to protocol. * UploadPackRequest is now defined as an embedding of UploadRequest and UploadHaves. * Move http encoding specific code from UploadPackRequest to transport/http. * rename UlReq to UploadRequest * packp: move AdvRefs Encoder/Decoder to Encode/Decode methods. * packp: move UploadRequest Encoder/Decoder to Encode/Decode methods. * packp: Remove transport.UploadPackInfo in favor of packp. AdvRefs.
* move: format/packp -> protocol/packp (#141)Santiago M. Mola2016-11-254-22/+20
| | | | | | | | | | | | | | | | | | | | | | | * move: format/packp -> protocol/packp * format/packp -> protocol/packp * format/packp/pktline -> format/pktline. * move: protocol/packp/ulreq/* -> protocol/packp/* * protocol/packp: rename UlReq types to make them unique. * * protocol/packp: namespace UlReq encoder. * protocol/packp: namespace UlReq decoder. * protocol/packp: fix example names * move: protocol/packp/advrefs/* -> protocol/packp/* * further ulreq namespacing * protocol/packp: namespace AdvRefs types.
* plumbing/transport: add common tests and fixes. (#136)Santiago M. Mola2016-11-2513-240/+367
| | | | | | | | | | | | | | | | | | | * plumbing/transport: add common tests and fixes. * add common test suite for different transport implementations. * fix different behaviour on error handling for ssh and http. fixes issue #123. * support detecting unexisting repositories with SSH + GitHub/Bitbucket (apparently, there is no standard for all SSH servers). * remove ssh.NewClient (only DefaultClient makes sense at the moment). * make ssh.Client and http.Client private. * utils/ioutil: utilities to work with io interfaces. * * transport: test actual objects fetched, not just packfile size. * * fix doc typo. * * improve UploadPackRequest.IsEmpty
* transport: create Client interface (#132)Santiago M. Mola2016-11-2319-0/+1828
* plumbing: move plumbing/client package to plumbing/transport. * transport: create Client interface. * A Client can instantiate any client transport service. * InstallProtocol installs a Client for a given protocol, instead of just a UploadPackService. * A Client can open a session for fetch-pack or send-pack for a specific Endpoint. * Adapt ssh and http clients to the new client interface. * updated doc