Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit cache-side progress as messages to the client #23

Open
gurjeet opened this issue Jul 13, 2020 · 2 comments
Open

Emit cache-side progress as messages to the client #23

gurjeet opened this issue Jul 13, 2020 · 2 comments

Comments

@gurjeet
Copy link
Contributor

gurjeet commented Jul 13, 2020

Consider this is a enhancement-request. I configured my global config to use the cache, and ran fetch on an existing large repo. Since it's an existing repo, I naively expected the fetch to be quick. But since the cache had never cloned this repo before, it seemed like the client was hung, with no response messages from the server.

The cache should emit messages, which should then be shown by the client to let the user know that the cache is working on it, and if possible show some sense of progress.

For example, it would be a great UX improvement if the user saw a message like

remote: git-cache: Cloning populating cache of this remote for the first time,
remote: git-cache: it may take some time.

Below are sample sessions from the client and the cache's output.


$ git config --global url."http://localhost:9898/github.com/".insteadOf [email protected]:
$ git remote -v
origin  http://localhost:9898/github.com/kubernetes/kubernetes.git (fetch)
origin  http://localhost:9898/github.com/kubernetes/kubernetes.git (push)
[gurjeetsingh@GC02WR5SLHTD6E:ttys032 ~/dev/KUBERNETES] time:1 exit:0 T175552 (master)
$ git fetch --all
Fetching origin
<command appears to be hung here for many minutes>

Server session

$ npm run build && ./bin/git-cache-http-server.js --cache-dir /tmp/git-cache-test/ --port 9898
...
INFO: listening to port: 9898
...
GET /github.com/kubernetes/kubernetes.git/info/refs?service=git-upload-pack
INFO: authenticating on the upstream repo github.com/kubernetes/kubernetes.git
INFO: updating: fetching from github.com/kubernetes/kubernetes.git
WARN: updating: fetch failed

fatal: cannot change to '/tmp/git-cache-test/github.com/kubernetes/kubernetes.git': No such file or directory

WARN: continuing with clone
<cache-server appears to be hung here for many minutes>
@jonasmalacofilho
Copy link
Owner

This is a good idea.

Any idea how we can send this messages to the client?
(it's been a long time since I studied the git HTTP protocol)

@gurjeet
Copy link
Contributor Author

gurjeet commented Jul 14, 2020

https://lmgtfy.com/?q=git+server+send+messages+to+client :-)

In all seriousness, though, I haven't studied the Git protocol, but sending informational messages to the user via the client seems to be commonplace now; I have seen Github send URLs to create pull-requests, and SourceHut sends URLs to create repo for a non-existent repo, etc.

I think it'd be a good item for a first-time contributor (including myself) to work on, given some time on hand.

It may be as simple as emitting messages to stdout/stderr, per https://stackoverflow.com/a/25762100/382700.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants