* Separate partitioning from globbing in cmdutil/args package and consumers
In the previous commit, GlobPaths was overloaded, containing logic
specific to command use-cases. This commit removes that functionality from
GlobPaths and back into the commands that have the special use-cases.
To do this, I've introduced a new Partition util in cmdutil/args.go that
will separate a slice into two slices given a predicate. This functionality
is leveraged by both the special use-cases described above to separate the
command-specific syntax from the globable filepaths.
* Add test to validate that the order of '-' in gh gist create args doesn't matter
Enables up to 3 retries of uploading a single asset when encountering a network error or a HTTP 5xx error.
Bonus:
- simplifies ConcurrentUpload implementation
- support Go context cancellation
This changes the FetchRelease implementation to look up draft releases directly using by its pending tag name, as opposed to resorting to the Releases list API which is backed by Elastic Search and thus suffers replication lag after the creation of a draft release.
Bonus: all release lookup functions now accept a context for cancellation.
When using GITHUB_TOKEN in Actions, the permissions on a repository are
null and therefore we can't check whether the viewer has push access or
not. The solution is to unconditionally check for draft releases instead
of trying to be smart about it. Draft releases are going to be on top,
so we don't have to paginate through all releases in a repository.
The `Request.GetBody` func allows the retry mechanism to reopen the file
that's being uploaded as the request body in case the body of the
previous request has already started to be read.
Hopefully fixes the error:
http2: Transport: cannot retry err [stream error: stream ID 1; REFUSED_STREAM]
after Request.Body was written; define Request.GetBody to avoid this error
Ref. d523dce5a7/http2/transport.go (L554)
Currently the mimecap package is an requirement to pass the test suite,
as we need /etc/mime.types to recognize the tar extension. A better idea
is to inline all of the basic test cases for the test suite.
Signed-off-by: Morten Linderud <morten@linderud.pw>