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
Info messages while pushing/fetching #106
Comments
This is what I'm getting from a successful push:
But my git server is sending messages that are not shown here. It would be nice if the returned promise was also a readable stream for these messages. @wmhilton if you point me in the right direction I could help you get this done |
OK so. I know I implemented this for pull... I'm not sure if I implemented it for push. (goes and looks at code) Nope didn't implement it for push yet. For Here's a snippet from ...
let emitter = new EventEmitter()
emitter
.on('message', output.push.bind(output))
.on('progress', progress.push.bind(progress))
// Test
await fetch({
fs,
gitdir,
emitter,
depth: 1,
singleBranch: true,
remote: 'origin',
ref: 'test-branch-shallow-clone'
})
... The 'message' events are the raw messages. The 'progress' events are a synthetic thing that I added in case you just want to use them for a progress bar. Um... that should help you get started. I'll have to fix my code for "push" though so it also emits message events. Just out of curiosity, what messages is your git server sending on push that you're interested in? |
Thanks! I'll work on this when I get a moment
My git server transpiles the code and install all dependencies using the server-side update hook. It's nice to see those messages as an indication of progress. |
Holy 🐄 that's awesome!! Is that something you wrote? That sounds like an awesome git server. I'm working on adding git server features to isomorphic-git, so it'll be possible to use it as an Express middleware to do stuff like that. I hadn't thought about git-hooks yet though. I guess that would be an interesting starting point for the API. |
Yeah, thanks! it's for this sort of hosted OS that I'm working on. The repos you push are programs that run on your OS so they have the same structure. The git server rejects a push if the head ref of the master branch (a convention) can't be transpiled or doesn't have the right file structure. It works pretty nicely, I think Heroku works similarly, or it used to. |
Status update: spending some time today looking into this |
Hey @wmhilton. I misunderstood your first response and thought you were giving me instructions on how to implement it for push (as opposed to just using it), and I thought, hmm, looks simple enough, but of course, it's not :) I'm still giving it a shot, I might be able to figure out how to implement the push version. I added a test to |
I guess I really do need a better "How to Contribute" section to the README. I never expected this many contributors before I hit 1.0! Heck, this repo's not even at 100 stars. Short answer is: Yes! try Even longer answer is there's ALSO Jasmine tests that run in karma. Because I didn't realize that Jest didn't run in the browser when I started writing tests. All that being said......... lemme see if I can just knock this out for ya! |
👏👏👏👏👏 |
I pushed a |
Hmm I'm not seeing any of the two events being fired. I wanna take a closer look but I have to leave for now. I'll run another test when I come back |
To generate such messages, do I just use "echo" in a post-recieve git hook? (Is that what you're using?) |
Yeah that's exactly what I'm using
…On Fri, Mar 23, 2018, 4:57 PM William Hilton ***@***.***> wrote:
To generate such messages, do I just use "echo" in a post-recieve git
hook? (Is that what you're using?)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWF2J1PCpKUJkRzrWjDPIMIJgAr--Wgks5thYv3gaJpZM4SxM14>
.
|
Actually the hook is called "update"
…On Fri, Mar 23, 2018, 5:02 PM Juan Campa ***@***.***> wrote:
Yeah that's exactly what I'm using
On Fri, Mar 23, 2018, 4:57 PM William Hilton ***@***.***>
wrote:
> To generate such messages, do I just use "echo" in a post-recieve git
> hook? (Is that what you're using?)
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#106 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABWF2J1PCpKUJkRzrWjDPIMIJgAr--Wgks5thYv3gaJpZM4SxM14>
> .
>
|
Ha! OK. I figured out how to do it without setting up apache. :) Now I will see if I can use this new knowledge to write a unit test using such a git remote. |
I've now written my first karma plugin, https://npm.im/karma-git-http-server-middleware! It exposes the main directory so that tests can directly do git.clone on "http://localhost:9876/__tests__/__fixtures__/test-clone.git". Unfortunately I forgot I'd need a way to start and stop the git server for non-karma tests (yay isomorphic tests) so I still need to add that. |
#113 is an attempt to add support for http-servable git repo fixtures. If it works, it should support creating new repo test fixtures complete with "update" and "post-receive" git hooks! |
#116 changes the git response parser to a streaming parser. That's necessary for the git push messages to be streamed instead of returned all at once at the end. Much more useful to know what's going on and get some feedback during the push. |
#128 adds emitting status messages during git push, but I still need to add real tests. I'm not sure if it works yet lol. |
Sorry I haven't been able to help you here. I've been working on other
things. I'll try this out as soon as possible though
…On Thu, Apr 5, 2018, 8:16 PM William Hilton ***@***.***> wrote:
#128 <#128> adds
emitting status messages during git push, but I still need to add real
tests. I'm not sure if it works yet lol.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWF2ASBMQjp5pXN5JEkw7uQQ9plTVBiks5tlt3vgaJpZM4SxM14>
.
|
No worries @juancampa I think I've got everything in place now to add a unit test simulating your scenario. I've created a karma plugin that lets you push to a git repo, but when you start a push operation it makes temporary copy of the got directory and operates on that, leaving the original untouched. This way you can rerun the tests over and over (or have five browsers run the same test in parallel) and the target repository will be in the same state. Quick question for ya though before I write the test for this: how much time are the messages sent back from your server? Are we measuring in seconds ("build succeeded!") or minutes ("build started... build completed... tests started... test 1 passed... test 2 passed... tests completed... starting server... server running")? |
That plugin sounds awesome.
For my use case it's generally in the order 5s-20s depending on how much
transpiling/bundling it has to do.
…On Sat, Apr 7, 2018, 9:19 AM William Hilton ***@***.***> wrote:
No worries @juancampa <https://github.com/juancampa> I think I've got
everything in place now to add a unit test simulating your scenario. I've
created a karma plugin that lets you push to a git repo, but when you start
a push operation it makes temporary copy of the got directory and operates
on that, leaving the original untouched. This way you can rerun the tests
over and over (or have five browsers run the same test in parallel) and the
target repository will be in the same state.
Quick question for ya though before I write the test for this: how much
time are the messages sent back from your server? Are we measuring in
seconds ("build succeeded!") or minutes ("build started... build
completed... tests started... test 1 passed... test 2 passed... tests
completed... starting server... server running")?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWF2KhCc7PieQP0w222o7rzIGRvcQYaks5tmOcbgaJpZM4SxM14>
.
|
I just tried to build the
Any thoughts? |
False alarm, I was using yarn instead of npm to install dependencies. Probably had the wrong dependencies |
This doesn't seem like a false alarm though:
Might be an error in mbostock's Seems to happen in both Chrome and Firefox |
My guess is that the stream returned by Update: I'm getting this with v0.9.9 from npm as well. During pull. |
Hmm. When it rains it pours. I'm not too worried you got errors trying to build the push-messages branch... I've been force-pushing to it multiple times today lol... but getting the error in the published version is sad.
Most likely it's not a problem in |
🎉 This issue has been resolved in version 0.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Yay! I finally got it working and have tests to demonstrate it: Usage Example: let emitter = new EventEmitter()
.on('message', msg => console.log('remote: ' + msg))
// Test
let res = await push({
fs,
gitdir,
emitter,
remote: 'karma',
ref: 'refs/heads/master'
}) |
@wmhilton I tried testing this with 0.10 but I'm still getting the |
Hmm. My tests must be doing something different than what your code is doing, because I haven't seen that error. I might have to see how you're calling isomorphic-git. Can you open an issue with a code example? 🐛 |
@juancampa Are you using Webpack?! I just found (and solved) a very similar problem, I think. |
I am! I'll try it out. Is it the latest on npm?
…On Sun, Apr 22, 2018, 5:40 PM William Hilton ***@***.***> wrote:
@juancampa <https://github.com/juancampa> Are you using Webpack?! I just
found (and solved) a very similar problem, I think.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWF2GMAukSgRt3jXkxDObqFHb0hukqPks5trPi9gaJpZM4SxM14>
.
|
That could be it then! And no, it's still on a branch. It's taking me a while to get all the build tests passing and stuff. |
I've got it working on everything except Safari. But the Safari bug is proving extremely tricky to hunt down. When I first converted it to webpack, I wasn't using Babel and was shocked that the build was nearly 100% smaller. So now I'm trying to minimize the amount of transpiling. I dropped support for the "Android" browser and added support for the "ChromeAndroid" browser, and then |
I thought those days were over after |
I just tried the |
I take it back, wasn't building correctly. I'm doing more tests. Still trying |
So what I had to do to get it to build was add an alias:
I would think that the compiled version would Just Work, but if people are going to be building it from source, maybe I should try a different fix. Like, maybe import |
OK try v0.11.0. I changed |
Hey thanks again for being so helpful. v0.11.0 is not working for me. Babel is complaining that it has object spread syntax which is not expecting in any node_modules file. It seems like your .babelrc has (line 454)
|
The good news is that I manually passed |
Wait... does Webpack or Babel or whatever use |
What version of Babel are you running? Maybe I need to make a note of that... |
I'm using It doesn't seem to matter if I use |
I found this comment by Dan Abramov webpack/webpack#1979 (comment)
|
Oh I know what's going on here. Next.js has server-side-rendering so it transpiles everything for both environments! |
I'm currently working around the issue by using webpack's server-side: client-side: The server-side one is good and I'm keeping it because I don't really use git on the server but it shouldn't be needed. I'm not sure however why the client-side is needed, webpack should be looking at your package.json's |
Rest/Spread Properties are actually a Stage 4 proposal and will be officially part of ECMAScript 2018 in June. But I shall remove them from now, since they are causing this issue and are only used in a couple places. |
Is there a way to get the informational messages sent by the server while pushing/fetching? I'm talking about what is normally prefixed by
remote: ....
in regular command-line git.The text was updated successfully, but these errors were encountered: